[SF#843] Fix on UID shown instead of EUID (thanks to Alberto Sepo).
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 21 Jan 2017 19:10:36 +0000 (21:10 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 21 Jan 2017 19:10:36 +0000 (21:10 +0200)
src/xfce-taskmanager-linux.c

index 0717b0a..36656fb 100644 (file)
@@ -169,7 +169,10 @@ void get_task_details(pid_t pid,struct task *task)
                task->time_percentage = 0;
                task->ppid = ppid;
 
-               fstat(fd,&st);
+               sprintf(line,"/proc/%d/task",(int)pid);
+               /* SF bug #843: /proc/%d/stat owned by UID instead of EUID */
+               if (stat(line,&st) < 0)
+                       fstat(fd,&st);
                task->uid=st.st_uid;
                passwdp = getpwuid(task->uid);
                if( passwdp != NULL && passwdp->pw_name != NULL)