summaryrefslogtreecommitdiffstats
path: root/tools/regression/p1003_1b/sched.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-11-03 09:45:44 -0200
committerRenato Botelho <renato@netgate.com>2015-11-03 09:45:44 -0200
commitc7275b999acdea9746ff095cf10188b4a3d09b7a (patch)
treea95eeaad8a2157ed3641d93c98bdc108bcd728d4 /tools/regression/p1003_1b/sched.c
parent2b0a9fbf7a64ff2e54d03cebd5bc2d787026eaf8 (diff)
parentfe49fc6e1c94b6c41d1d3844ca219a76da3c70dc (diff)
downloadFreeBSD-src-c7275b999acdea9746ff095cf10188b4a3d09b7a.zip
FreeBSD-src-c7275b999acdea9746ff095cf10188b4a3d09b7a.tar.gz
Merge branch 'stable/10' into devel
Diffstat (limited to 'tools/regression/p1003_1b/sched.c')
-rw-r--r--tools/regression/p1003_1b/sched.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/tools/regression/p1003_1b/sched.c b/tools/regression/p1003_1b/sched.c
index bd978f8..1814c79 100644
--- a/tools/regression/p1003_1b/sched.c
+++ b/tools/regression/p1003_1b/sched.c
@@ -41,16 +41,17 @@
#define _POSIX_SOURCE
#define _POSIX_C_SOURCE 199309L
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <string.h>
+#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/mman.h>
-
+#include <limits.h>
#include <sched.h>
+#include <stdio.h>
+#define __XSI_VISIBLE 1
+#include <stdlib.h>
+#undef __XSI_VISIBLE
+#include <string.h>
+#include <unistd.h>
#include "prutil.h"
@@ -209,17 +210,14 @@ int sched(int ac, char *av[])
{
-#define NAM "P1003_1b_schedXXXX"
- char nam[L_tmpnam];
+ char nam[] = "P1003_1b_schedXXXXXX";
int fd;
pid_t p;
pid_t *lastrun;
- strcpy(nam, NAM);
- if (tmpnam(nam) != nam)
- q(__LINE__, errno, "tmpnam " NAM);
- q(__LINE__, (fd = open(nam, O_RDWR|O_CREAT, 0666)),
- "open " NAM);
+ fd = mkstemp(nam);
+ if (fd == -1)
+ q(__LINE__, errno, "mkstemp failed");
(void)unlink(nam);
OpenPOWER on IntegriCloud