redhat analysis: proc/readproc

This commit is contained in:
Jim Warner 2011-10-06 08:34:26 -05:00 committed by Sami Kerola
parent f9ae59f5df
commit 4820619f15

View File

@ -1112,15 +1112,13 @@ next_proc:
} }
next_task: next_task:
for (;;) { // fills in our path, plus x->tid and x->tgid
// fills in our path, plus x->tid and x->tgid if ((!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid
if ((!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid || (!(ret = PT->taskreader(PT,new_p,x,path)))) { // simple_readtask
|| (!(ret = PT->taskreader(PT,new_p,x,path)))) { // simple_readtask goto next_proc;
goto next_proc;
}
if (!new_p) new_p = ret;
return ret;
} }
if (!new_p) new_p = ret;
return ret;
end_procs: end_procs:
if (!saved_x) free(x); if (!saved_x) free(x);
@ -1152,7 +1150,7 @@ PROCTAB* openproc(int flags, ...) {
PT->finder = listed_nextpid; PT->finder = listed_nextpid;
}else{ }else{
PT->procfs = opendir("/proc"); PT->procfs = opendir("/proc");
if(!PT->procfs) return NULL; if(!PT->procfs) { free(PT); return NULL; }
PT->finder = simple_nextpid; PT->finder = simple_nextpid;
} }
PT->flags = flags; PT->flags = flags;