Open markk opened 1 year ago
Note that writing to stdout works:
sndfile-mix-to-mono noise.wav - > noise-mono.wav
... but that is not what --help
describes as the correct usage.
Hi @markk . Thanks for report.
This is the culprit:
/* Delete the output file length to zero if already exists. */
remove (argv [argc - 1]);
Note the confusing comment: perhaps it used to truncate the file to zero if it existed; now it unlinks the file from the filesystem, which means it will get removed once the program terminates.
Apparently, there is no reason to do that: if it exists, it will get overwritten. Even if the one that exists is longer, it will get (correctly) overwritten by a new shorter one, i.e. it is not like the rest of the old long one remains.
So a trivial fix is to just not do this.
strace shows the output file being unlinked after being opened.
test.txt