]> git.lizzy.rs Git - plan9front.git/commitdiff
ip/tftpd: use procsetuser() instead of writing #c/user
authorcinap_lenrek <cinap_lenrek@felloff.net>
Tue, 23 Feb 2021 00:41:09 +0000 (01:41 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Tue, 23 Feb 2021 00:41:09 +0000 (01:41 +0100)
sys/src/cmd/ip/tftpd.c

index ab6d91f70e871d98db853e886ed155a419ee58a5..aa69b3423eb73594605ea6b36861aa12f75e6ed2 100644 (file)
@@ -738,12 +738,8 @@ nak(int fd, int code, char *msg)
 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");
 }