summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-10-12 16:09:00 +0200
committerJim Meyering <meyering@redhat.com>2008-10-16 23:00:22 +0200
commit16c806208576ebc5713d74e828198caba0c5fd5a (patch)
treeb499ee183579db7f3b9e9761677682fb5f937335
parent17278118eef6ee156c810bc3b624716034dcdf87 (diff)
downloadcoreutils-16c806208576ebc5713d74e828198caba0c5fd5a.tar.xz
mktemp: diagnose freopen failure
* src/mktemp [--quiet]: Don't ignore freopen failure.
-rw-r--r--src/mktemp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mktemp.c b/src/mktemp.c
index ffb21d466..2e6dc7b85 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -188,7 +188,9 @@ main (int argc, char **argv)
{
/* From here on, redirect stderr to /dev/null.
A diagnostic from getopt_long, above, would still go to stderr. */
- freopen ("/dev/null", "wb", stderr);
+ if (!freopen ("/dev/null", "wb", stderr))
+ error (EXIT_FAILURE, errno,
+ _("failed to redirect stderr to /dev/null"));
}
n_args = argc - optind;