about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
Diffstat (limited to 'grp')
-rw-r--r--grp/tst_fgetgrent.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/grp/tst_fgetgrent.c b/grp/tst_fgetgrent.c
index 501ad99727..d612445fed 100644
--- a/grp/tst_fgetgrent.c
+++ b/grp/tst_fgetgrent.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 static int errors;
 
@@ -99,7 +100,14 @@ test_fgetgrent (const char *filename)
 int
 main (int argc, char *argv[])
 {
-  char *file = tmpnam (NULL);
+  char file[] = "/tmp/tst_fgetgrent.XXXXXX";
+  int fd = mkstemp (file);
+  if (fd == -1)
+    {
+      printf ("mkstemp failed: %m\n");
+      return 1;
+    }
+  close (fd);
   int i = 0;
 
   if (argc > 1)