Remember to truncate the output file

This commit is contained in:
Přemysl Eric Janouch 2016-12-25 01:54:39 +01:00
parent d52dcd1de7
commit 6ebb141b1d
Signed by: p
GPG Key ID: B715679E3A361BE6

View File

@ -725,7 +725,7 @@ main (int argc, char *argv[])
FILE *output_file;
#ifdef __unix__
int output_fd;
if ((output_fd = open (output_path, O_CREAT | O_WRONLY, 0777)) < 0)
if ((output_fd = open (output_path, O_CREAT|O_WRONLY|O_TRUNC, 0777)) < 0)
exit_fatal ("open: %s: %s\n", output_path, strerror (errno));
if (!(output_file = fdopen (output_fd, "w")))
exit_fatal ("fdopen: %s\n", strerror (errno));