summaryrefslogtreecommitdiffstats
path: root/tools/regression
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-04-11 02:50:44 +0000
committerngie <ngie@FreeBSD.org>2015-04-11 02:50:44 +0000
commit618be626c3c645863fdb68d1b937572d6e46014a (patch)
tree63f98bd1cb2dc3905da7c2be8209c8d7befa45c9 /tools/regression
parent34b5443a481794cf49eda3a9a223da330f16205c (diff)
downloadFreeBSD-src-618be626c3c645863fdb68d1b937572d6e46014a.zip
FreeBSD-src-618be626c3c645863fdb68d1b937572d6e46014a.tar.gz
- 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
Diffstat (limited to 'tools/regression')
-rw-r--r--tools/regression/sockets/reconnect/reconnect.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/tools/regression/sockets/reconnect/reconnect.c b/tools/regression/sockets/reconnect/reconnect.c
index 02922bf..52811b3 100644
--- a/tools/regression/sockets/reconnect/reconnect.c
+++ b/tools/regression/sockets/reconnect/reconnect.c
@@ -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);
OpenPOWER on IntegriCloud