diff --git a/proc/readproc.c b/proc/readproc.c index f8561c1e..0f002315 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -1383,13 +1383,17 @@ out: proc_t* readeither (PROCTAB *restrict const PT, proc_t *restrict x) { static proc_t skel_p; // skeleton proc_t, only uses tid + tgid static proc_t *new_p; // for process/task transitions + static int canary; char path[PROCPATHLEN]; proc_t *saved_x, *ret; saved_x = x; if (!x) x = xcalloc(sizeof(*x)); else free_acquired(x,1); - if (new_p) goto next_task; + if (new_p) { + if (new_p->tid != canary) new_p = NULL; + goto next_task; + } next_proc: new_p = NULL; @@ -1406,7 +1410,10 @@ next_task: || (!(ret = PT->taskreader(PT,new_p,x,path)))) { // simple_readtask goto next_proc; } - if (!new_p) new_p = ret; + if (!new_p) { + new_p = ret; + canary = new_p->tid; + } return ret; end_procs: