shithub: plan9front

Download patch

ref: a96cf495fa9a315c86c723bd0a0bcd8bffaef42a
parent: 5347bb9c96c79296e6b520014d2ed2a5ee0a718d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Feb 22 19:41:09 EST 2021

ip/tftpd: use procsetuser() instead of writing #c/user

--- a/sys/src/cmd/ip/tftpd.c
+++ b/sys/src/cmd/ip/tftpd.c
@@ -738,12 +738,8 @@
 void
 setuser(void)
 {
-	int fd;
-
-	fd = open("#c/user", OWRITE);
-	if(fd < 0 || write(fd, "none", strlen("none")) < 0)
+	if(procsetuser("none") < 0)
 		sysfatal("can't become none: %r");
-	close(fd);
 	if(newns("none", nil) < 0)
 		sysfatal("can't build namespace: %r");
 }