]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/procutils: check fgets() return value [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 12:11:28 +0000 (14:11 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 12:11:28 +0000 (14:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/procutils.c

index 8da11e65ad26b2d1ef09329f51aea023f2a9a9b2..ef969417dd665e115896b5c9758b56ff625cf20f 100644 (file)
@@ -174,6 +174,8 @@ int proc_next_pid(struct proc_processes *ps, pid_t *pid)
 
                        p = fgets(buf, sizeof(buf), f);
                        fclose(f);
+                       if (!p)
+                               continue;
 
                        if (sscanf(buf, "%*d (%255[^)])", procname) != 1)
                                continue;