summaryrefslogtreecommitdiff
path: root/src/mktemp.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-11-05 12:19:45 -0700
committerEric Blake <ebb9@byu.net>2009-11-07 10:10:25 -0700
commitc768e2231b89901a2e29c3bf96c027b64f8646d9 (patch)
treeef0381745bb5f50fd882100375921cccfd3ddd87 /src/mktemp.c
parent9a8d8f46a541d333f98dca26d053d1f5bd4424bb (diff)
downloadcoreutils-c768e2231b89901a2e29c3bf96c027b64f8646d9.tar.xz
mktemp: fix bug with -q and closed stdout
If stdin or stdout is closed, then freopen(,stderr) can violate the premise that STDERR_FILENO==fileno(stderr), which in turn breaks mktemp -q. * bootstrap.conf (gnulib_modules): Add freopen-safer. * src/mktemp.c (includes): Use stdio--.h. * tests/misc/close-stdout: Enhance test to catch bug.
Diffstat (limited to 'src/mktemp.c')
-rw-r--r--src/mktemp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mktemp.c b/src/mktemp.c
index 6ce40f133..303b9ce9e 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -17,7 +17,6 @@
/* Written by Jim Meyering and Eric Blake. */
#include <config.h>
-#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
@@ -27,6 +26,7 @@
#include "error.h"
#include "filenamecat.h"
#include "quote.h"
+#include "stdio--.h"
#include "tempname.h"
/* The official name of this program (e.g., no `g' prefix). */