From: Ruediger Meier Date: Fri, 8 May 2015 22:47:33 +0000 (+0200) Subject: procutils: reset errno before readdir X-Git-Tag: v2.27-rc1~141 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f4fc8c1d09fcbc154b956c6295fbca9d6b888e5;p=thirdparty%2Futil-linux.git procutils: reset errno before readdir readdir(3p): "When the end of the directory is encountered, a null pointer shall be returned and errno is not changed" Signed-off-by: Ruediger Meier --- diff --git a/lib/procutils.c b/lib/procutils.c index ef969417dd..1823d16b1b 100644 --- a/lib/procutils.c +++ b/lib/procutils.c @@ -143,6 +143,7 @@ int proc_next_pid(struct proc_processes *ps, pid_t *pid) do { char buf[BUFSIZ], *p; + errno = 0; d = readdir(ps->dir); if (!d) return errno ? -1 : 1; /* error or end-of-dir */