[Flac-dev] [PATCH] Don't stat '-' when writing to stdout
Tom Hargreaves
hex at freezone.co.uk
Fri Oct 14 13:15:04 PDT 2005
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;
}
More information about the Flac-dev
mailing list