Author: ngie Date: Sat Apr 11 02:50:44 2015 New Revision: 281391 URL: https://svnweb.freebsd.org/changeset/base/281391
Log: - Use static buffers for temporary file paths instead of strdup of constant strings - Don't use /tmp because it's outside ATF's prescribed sandbox - Use mkstemp instead of mktemp to eliminate warning MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/sockets/reconnect/reconnect.c Modified: head/tools/regression/sockets/reconnect/reconnect.c ============================================================================== --- head/tools/regression/sockets/reconnect/reconnect.c Sat Apr 11 02:23:59 2015 (r281390) +++ head/tools/regression/sockets/reconnect/reconnect.c Sat Apr 11 02:50:44 2015 (r281391) @@ -45,8 +45,8 @@ #include <string.h> #include <unistd.h> -static char *uds_name1 = NULL; -static char *uds_name2 = NULL; +static char uds_name1[] = "reconnect.XXXXXXXX"; +static char uds_name2[] = "reconnect.XXXXXXXX"; #define sstosa(ss) ((struct sockaddr *)(ss)) @@ -112,20 +112,14 @@ main() atexit(cleanup); - uds_name1 = strdup("/tmp/reconnect.XXXXXX"); - if (uds_name1 == NULL) - err(1, "can't allocate memory"); - uds_name1 = mktemp(uds_name1); - if (uds_name1 == NULL) - err(1, "mktemp(3) failed"); + if (mkstemp(uds_name1) == -1) + err(1, "mkstemp"); + unlink(uds_name1); s_sock1 = create_uds_server(uds_name1); - uds_name2 = strdup("/tmp/reconnect.XXXXXX"); - if (uds_name2 == NULL) - err(1, "can't allocate memory"); - uds_name2 = mktemp(uds_name2); - if (uds_name2 == NULL) - err(1, "mktemp(3) failed"); + if (mkstemp(uds_name2) == -1) + err(1, "mkstemp"); + unlink(uds_name2); s_sock2 = create_uds_server(uds_name2); c_sock = socket(PF_LOCAL, SOCK_DGRAM, 0); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"