summaryrefslogtreecommitdiff
path: root/posix/bug-getopt5.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:30:36 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:30:36 +0000
commit704e05ff173885df6d1d27f381604429f27fd4de (patch)
treefc67caec36bc5ed0c4190cafd38f69850a10ca0a /posix/bug-getopt5.c
parentecfe3e291f848cf598309d746619de62ea88fabb (diff)
parent3fcbb67b7949a8b362de5558bf1c6dd7ec5d21cf (diff)
Merge branch 't/tls-threadvar' into refs/top-bases/t/ONSTACK
Diffstat (limited to 'posix/bug-getopt5.c')
-rw-r--r--posix/bug-getopt5.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/posix/bug-getopt5.c b/posix/bug-getopt5.c
index ed2639d35b..4f67d9b2ec 100644
--- a/posix/bug-getopt5.c
+++ b/posix/bug-getopt5.c
@@ -2,6 +2,7 @@
#include <getopt.h>
#include <unistd.h>
#include <stdio.h>
+#include <stdlib.h>
static const struct option opts[] =
{
@@ -47,12 +48,14 @@ one_test (const char *fmt, int argc, char *argv[], int n, int expected[n])
static int
do_test (void)
{
- char *fname = tmpnam (NULL);
- if (fname == NULL)
+ char fname[] = "/tmp/bug-getopt5.XXXXXX";
+ int fd = mkstemp (fname);
+ if (fd == -1)
{
- puts ("cannot generate name for temporary file");
+ printf ("mkstemp failed: %m\n");
return 1;
}
+ close (fd);
if (freopen (fname, "w+", stderr) == NULL)
{