diff --git a/library/include/readproc.h b/library/include/readproc.h index d7ff50b3..e5fe1e77 100644 --- a/library/include/readproc.h +++ b/library/include/readproc.h @@ -281,7 +281,7 @@ PROCTAB *openproc(unsigned flags, ... /* pid_t *| uid_t *| dev_t *| char *[, int // with the previous process or thread. proc_t *readproc(PROCTAB *__restrict const PT, proc_t *__restrict p); proc_t *readeither(PROCTAB *__restrict const PT, proc_t *__restrict x); -int look_up_our_self(proc_t *p); +int look_up_our_self(void); void closeproc(PROCTAB *PT); char **vectorize_this_str(const char *src); diff --git a/library/pids.c b/library/pids.c index 267f8af3..1a2e8926 100644 --- a/library/pids.c +++ b/library/pids.c @@ -1381,11 +1381,10 @@ PROCPS_EXPORT struct pids_stack *fatal_proc_unmounted ( { struct pids_fetch *fetched; unsigned tid; - proc_t self; /* this is very likely the *only* newlib function where the context (pids_info) of NULL will ever be permitted */ - if (!look_up_our_self(&self) + if (!look_up_our_self() || (!return_self)) return NULL; diff --git a/library/readproc.c b/library/readproc.c index bd71d950..4bc9d964 100644 --- a/library/readproc.c +++ b/library/readproc.c @@ -1602,15 +1602,18 @@ void closeproc(PROCTAB *PT) { ////////////////////////////////////////////////////////////////////////////////// -int look_up_our_self(proc_t *p) { +int look_up_our_self(void) { struct utlbuf_s ub = { NULL, 0 }; int rc = 0; + proc_t p; + memset(&p, 0, sizeof(proc_t)); if(file2str("/proc/self", "stat", &ub) == -1){ fprintf(stderr, "Error, do this: mount -t proc proc /proc\n"); _exit(47); } - rc = stat2proc(ub.buf, p); // parse /proc/self/stat + rc = stat2proc(ub.buf, &p); // parse /proc/self/stat + free_acquired(&p); free(ub.buf); return !rc; }