96e2220068
Ever since 2003, the 'listed_nextpid' routine has been misrepresenting its duties. Far from finding processes in a list given to openproc, it just inserted the next pid in that list into the passed proc_t as BOTH a tgid and tid. There was no attempt to validate such values. The net result is that tid & tgid were valid only with a thread group leader. When called with a pid for some sibling thread, the resulting tgid would be incorrect. With this commit, our little function will now attempt to validate both the tid and tgid. If this should fail then the fallback position will be the same as what we inherited. So we're no worse off & likely much better. [ note that calling the function with a thread's pid ] [ likely stems from 2011 when a 'readeither' routine ] [ was added which dealt with both tasks and threads! ] Signed-off-by: Jim Warner <james.warner@comcast.net>