From 4fdba9627a668d08597940ce0fded1563489066a Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Fri, 7 Jan 2022 00:00:00 -0600 Subject: [PATCH] library: Better PID file checks (with one small tweak) Since gcc no longer warns of 'unreachable code', we'll just deal with any such possibility ourselves I guess. Signed-off-by: Jim Warner --- proc/readproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/readproc.c b/proc/readproc.c index cc55cdfc..a956f438 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -1365,7 +1365,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p) char *restrict const path = PT->path; for (;;) { ent = readdir(PT->procfs); - if (!ent || !ent->d_name[0]) return 0; + if (!ent || !ent->d_name[0]) break; if (*ent->d_name > '0' && *ent->d_name <= '9') { errno = 0; p->tgid = strtoul(ent->d_name, NULL, 10);