diff options
author | ngie <ngie@FreeBSD.org> | 2015-04-11 07:33:04 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-04-11 07:33:04 +0000 |
commit | afc8d7d9c832d59dd0b4f8a9b7814a1b557e5424 (patch) | |
tree | 0e789cec7a026860e819b1310bafe0837986256d /tools | |
parent | 91dbe60db8281586649ef58289e3137dc8bee60b (diff) | |
download | FreeBSD-src-afc8d7d9c832d59dd0b4f8a9b7814a1b557e5424.zip FreeBSD-src-afc8d7d9c832d59dd0b4f8a9b7814a1b557e5424.tar.gz |
Fix warnings, bump WARNS to 6, and use a temporary socket instead of one in /tmp
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/sockets/pr_atomic/Makefile | 2 | ||||
-rw-r--r-- | tools/regression/sockets/pr_atomic/pr_atomic.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tools/regression/sockets/pr_atomic/Makefile b/tools/regression/sockets/pr_atomic/Makefile index b7ed9a6..1dc85ff 100644 --- a/tools/regression/sockets/pr_atomic/Makefile +++ b/tools/regression/sockets/pr_atomic/Makefile @@ -2,6 +2,6 @@ PROG= pr_atomic MAN= -WARNS?= 3 +WARNS?= 6 .include <bsd.prog.mk> diff --git a/tools/regression/sockets/pr_atomic/pr_atomic.c b/tools/regression/sockets/pr_atomic/pr_atomic.c index 69bbac7..e902cf7 100644 --- a/tools/regression/sockets/pr_atomic/pr_atomic.c +++ b/tools/regression/sockets/pr_atomic/pr_atomic.c @@ -42,31 +42,31 @@ #include <errno.h> #include <unistd.h> -#define TEST_SOCKET "/tmp/test_socket" +static char socket_path[] = "tmp.XXXXXX"; static jmp_buf myjmpbuf; -void handle_sigalrm(int signo); - -void handle_sigalrm(int signo) +static void handle_sigalrm(int signo __unused) { longjmp(myjmpbuf, 1); } int -main(int argc, char *argv[]) +main(void) { struct sockaddr_un un; pid_t pid; int s; + if (mkstemp(socket_path) == -1) + err(1, "mkstemp"); s = socket(PF_LOCAL, SOCK_DGRAM, 0); if (s == -1) errx(-1, "socket"); memset(&un, 0, sizeof(un)); un.sun_family = AF_LOCAL; - unlink(TEST_SOCKET); - strcpy(un.sun_path, TEST_SOCKET); + unlink(socket_path); + strcpy(un.sun_path, socket_path); if (bind(s, (struct sockaddr *)&un, sizeof(un)) == -1) errx(-1, "bind"); pid = fork(); |