summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-11-05 16:26:19 +0100
committerJim Meyering <meyering@redhat.com>2009-11-05 16:32:52 +0100
commit22e4276ed1b3ef67446e8f003b7bcf7753cbc9bc (patch)
treed291bdd8c0c4aa720c07a500ed623f3bd31fe10b /src
parent25d2460ae3dcbfb557016bbac6e8568e258caed3 (diff)
downloadcoreutils-22e4276ed1b3ef67446e8f003b7bcf7753cbc9bc.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/mktemp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mktemp.c b/src/mktemp.c
index f60e82486..980ec3930 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -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);