Date: Sat, 11 Apr 2015 07:33:05 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281409 - head/tools/regression/sockets/pr_atomic Message-ID: <201504110733.t3B7X5nw047506@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sat Apr 11 07:33:04 2015 New Revision: 281409 URL: https://svnweb.freebsd.org/changeset/base/281409 Log: 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 Modified: head/tools/regression/sockets/pr_atomic/Makefile head/tools/regression/sockets/pr_atomic/pr_atomic.c Modified: head/tools/regression/sockets/pr_atomic/Makefile ============================================================================== --- head/tools/regression/sockets/pr_atomic/Makefile Sat Apr 11 06:40:38 2015 (r281408) +++ head/tools/regression/sockets/pr_atomic/Makefile Sat Apr 11 07:33:04 2015 (r281409) @@ -2,6 +2,6 @@ PROG= pr_atomic MAN= -WARNS?= 3 +WARNS?= 6 .include <bsd.prog.mk> Modified: head/tools/regression/sockets/pr_atomic/pr_atomic.c ============================================================================== --- head/tools/regression/sockets/pr_atomic/pr_atomic.c Sat Apr 11 06:40:38 2015 (r281408) +++ head/tools/regression/sockets/pr_atomic/pr_atomic.c Sat Apr 11 07:33:04 2015 (r281409) @@ -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();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504110733.t3B7X5nw047506>