[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flac-dev
Subject:    [Flac-dev] [PATCH] Don't stat '-' when writing to stdout
From:       hex () freezone ! co ! uk (Tom Hargreaves)
Date:       2005-12-09 19:53:17
Message-ID: 20051014201433.GD5014 () sphere ! chronosempire ! org ! uk
[Download RAW message or body]

Currently, flac erroneously aborts when a file named '-' exists when
writing to stdout.

The problem:

> [~]% flac -sdc test.flac >/dev/null
> [~]% touch -
> [~]% flac -sdc test.flac >/dev/null
> ERROR: output file - already exists, use -f to override

The solution: see attached diff.

Thanks,

Tom.

(Please cc: me on replies; I'm not subscribed.)
-------------- next part --------------
Index: main.c
===================================================================
RCS file: /cvsroot/flac/flac/src/flac/main.c,v
retrieving revision 1.122
diff -u -r1.122 main.c
--- main.c	3 Sep 2005 03:54:16 -0000	1.122
+++ main.c	14 Oct 2005 20:01:05 -0000
@@ -1503,7 +1503,7 @@
 	 * Error if output file already exists (and -f not used).
 	 * Use grabbag__file_get_filesize() as a cheap way to check.
 	 */
-	if(!option_values.test_only && !option_values.force_file_overwrite && \
grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { \
+	if(!option_values.test_only && !option_values.force_file_overwrite && \
strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { \
flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to \
override\n", outfilename);  return 1;
 	}
@@ -1683,7 +1683,7 @@
 	 * Error if output file already exists (and -f not used).
 	 * Use grabbag__file_get_filesize() as a cheap way to check.
 	 */
-	if(!option_values.test_only && !option_values.force_file_overwrite && \
grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { \
+	if(!option_values.test_only && !option_values.force_file_overwrite && \
strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { \
flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to \
override\n", outfilename);  return 1;
 	}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic