summaryrefslogtreecommitdiff
path: root/sys/src/libauth/procsetuser.c
blob: f9cac306b59e27f7a6d8e89d2882ce24c9477e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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;
}