Module Name: src
Committed By: christos
Date: Fri Aug 28 11:46:05 UTC 2020
Modified Files:
src/tests/net/net: t_unix.c
Log Message:
Remove unneeded sete{u,g}id pointed out by kre.
Remove dup unlink.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/tests/net/net/t_unix.c:1.22
--- src/tests/net/net/t_unix.c:1.21 Thu Aug 27 10:00:01 2020
+++ src/tests/net/net/t_unix.c Fri Aug 28 07:46:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unix.c,v 1.21 2020/08/27 14:00:01 christos Exp $ */
+/* $NetBSD: t_unix.c,v 1.22 2020/08/28 11:46:05 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.21 2020/08/27 14:00:01 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.22 2020/08/28 11:46:05 christos Exp $");
#else
#define getprogname() argv[0]
#endif
@@ -251,8 +251,6 @@ 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);
@@ -272,23 +270,19 @@ test(bool forkit, bool closeit, bool sta
srvrpid = getppid();
clntpid = getpid();
if (srvruid == 0) {
- clntuid = UID;
- clntgid = GID;
- setgid(clntgid);
- setegid(clntgid);
- setuid(clntuid);
- seteuid(clntuid);
+ setgid(clntgid = GID);
+ setuid(clntuid = UID);
} else {
- clntuid = srvruid;
clntgid = srvrgid;
+ clntuid = srvruid;
}
break;
case -1:
FAIL("fork");
default:
if (srvruid == 0) {
- clntuid = UID;
clntgid = GID;
+ clntuid = UID;
}
break;
}