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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-01-07 00:00:00 -06:00 committed by Craig Small
parent 39d4d147d7
commit 4fdba9627a

View File

@ -1365,7 +1365,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p)
char *restrict const path = PT->path; char *restrict const path = PT->path;
for (;;) { for (;;) {
ent = readdir(PT->procfs); 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') { if (*ent->d_name > '0' && *ent->d_name <= '9') {
errno = 0; errno = 0;
p->tgid = strtoul(ent->d_name, NULL, 10); p->tgid = strtoul(ent->d_name, NULL, 10);