Module Name:    src
Committed By:   christos
Date:           Fri Aug 28 13:56:30 UTC 2020

Modified Files:
        src/tests/net/net: t_unix.c

Log Message:
When running the tests with atf-run the directory we are running in is
drwx------ so when we change to a different user, we can't find the socket
we created.

Make a directory and put the socket in there. Of course now atf can't
record its results as a different user, but that is not fatal.

tc-se:FATAL ERROR: Cannot create results file '/tmp/atf-run.9vOjFd/tcr': \
Permission denied


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/net/t_unix.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.22 src/tests/net/net/t_unix.c:1.23
--- src/tests/net/net/t_unix.c:1.22	Fri Aug 28 07:46:05 2020
+++ src/tests/net/net/t_unix.c	Fri Aug 28 09:56:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $	*/
+/*	$NetBSD: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #define _GNU_SOURCE
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.23 2020/08/28 13:56:29 christos Exp $");
 #else
 #define getprogname() argv[0]
 #endif
@@ -241,6 +241,12 @@ test(bool forkit, bool closeit, bool sta
 	if ((sun = calloc(1, slen)) == NULL)
 		FAIL("calloc");
 
+	if (mkdir("sock", 0777) == -1)
+		FAIL("mkdir");
+
+	if (chdir("sock") == -1)
+		FAIL("chdir");
+
 	memset(sun->sun_path, 'a', len);
 	sun->sun_path[len] = '\0';
 	(void)unlink(sun->sun_path);
@@ -251,6 +257,8 @@ test(bool forkit, bool closeit, bool sta
 #endif
 	sun->sun_family = AF_UNIX;
 
+	unlink(sun->sun_path);
+
 	if (bind(srvr, (struct sockaddr *)sun, sl) == -1) {
 		if (errno == EINVAL && sl >= 256) {
 			close(srvr);

Reply via email to