Move getpwuid() from backends to gui, use getpwuid_r(), call only once on task add. (bug 14401)

This commit is contained in:
rim
2018-05-29 03:11:15 +03:00
committed by Landry Breuil
parent 40a3e65803
commit 8e1b48f8de
7 changed files with 17 additions and 25 deletions

View File

@@ -11,7 +11,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <unistd.h>
#include <string.h>
@@ -294,7 +293,6 @@ get_task_details (GPid pid, Task *task)
/* Parse the status file: it contains the UIDs */
{
struct passwd *pw;
guint dummy;
snprintf(filename, sizeof (filename), "/proc/%d/status", pid);
@@ -307,9 +305,6 @@ get_task_details (GPid pid, Task *task)
break;
}
fclose (file);
pw = getpwuid (task->uid);
g_strlcpy (task->uid_name, (pw != NULL) ? pw->pw_name : "nobody", sizeof (task->uid_name));
}
/* Read the full command line */