mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
mktemp: don't try to close stdout twice
* src/mktemp.c (main): Rather than calling close_stream (which would make atexit-called close_stdout try to close it a second time), check for write failure via ferror and fflush.
This commit is contained in:
1 parent
25d2460ae3
commit
22e4276ed1
1 file changed
+1
-1
+1
-1
@@ -325,7 +325,7 @@ main (int argc, char **argv)
|
||||
puts (dest_name);
|
||||
/* If we created a file, but then failed to output the file
|
||||
name, we should clean up the mess before failing. */
|
||||
if (!dry_run && close_stream (stdout))
|
||||
if (!dry_run && (ferror (stdout) || fflush (stdout) != 0))
|
||||
{
|
||||
int saved_errno = errno;
|
||||
remove (dest_name);
|
||||
|
||||
Reference in new issue
Block a user