ref: 7bcdd1b5d896816f6d403f86cd315819d0d03d07
dir: /sys/src/libauth/procsetuser.c/
#include <u.h> #include <libc.h> #include <auth.h> int procsetuser(char *user) { int fd, n; fd = open("#c/user", OWRITE|OCEXEC); if(fd < 0) return -1; n = strlen(user); if(write(fd, user, n) != n){ close(fd); return -1; } close(fd); return 0; }