Use UID instead of PID to identify the user to avoid changing projects everytime ##projects

This commit is contained in:
pancake 2021-01-02 12:28:09 +01:00 committed by pancake
parent 8d4709bc0b
commit f7000b7dcb

View File

@ -1239,12 +1239,12 @@ R_API void r_sys_set_environ(char **e) {
R_API char *r_sys_whoami (char *buf) {
char _buf[32];
int pid = getpid ();
int uid = getuid ();
int hasbuf = (buf)? 1: 0;
if (!hasbuf) {
buf = _buf;
}
sprintf (buf, "pid%d", pid);
sprintf (buf, "uid%d", uid);
return hasbuf? buf: strdup (buf);
}