library: repair <pids> api boo-boo in the 'select' i/f
The patch referenced below corrected some flaws in the
procps_pids_select implementation. But, there remained
one flaw which this commit will now hopefully address.
Rather than assume callers wished to select only tasks
and not threads meant a command like 'top -H -p 10329'
works differently under newlib than release 3.3.17. It
fails to honor the '-H' (threads) switch under newlib.
So, to fix that oops, we'll allow that select function
to get threads or tasks depending on its 'which' parm.
Reference(s):
. Oct 2015, some flaws corrected
commit bc616b3615
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -1126,7 +1126,7 @@ static proc_t *simple_readproc(PROCTAB *restrict const PT, proc_t *restrict cons
|
||||
goto next_proc;
|
||||
|
||||
if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
|
||||
goto next_proc; /* not one of the requested uids */
|
||||
goto next_proc; /* not one of the requested uids */
|
||||
|
||||
p->euid = sb.st_uid; /* need a way to get real uid */
|
||||
p->egid = sb.st_gid; /* need a way to get real gid */
|
||||
@ -1248,8 +1248,8 @@ static proc_t *simple_readtask(PROCTAB *restrict const PT, proc_t *restrict cons
|
||||
if (stat(path, &sb) == -1) /* no such dirent (anymore) */
|
||||
goto next_task;
|
||||
|
||||
// if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
|
||||
// goto next_task; /* not one of the requested uids */
|
||||
if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
|
||||
goto next_task; /* not one of the requested uids */
|
||||
|
||||
t->euid = sb.st_uid; /* need a way to get real uid */
|
||||
t->egid = sb.st_gid; /* need a way to get real gid */
|
||||
|
Reference in New Issue
Block a user