]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Do not return garbage in run_parts 487/head
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 3 Jan 2022 12:12:31 +0000 (13:12 +0100)
committerChristian Göttsche <cgzones@googlemail.com>
Mon, 3 Jan 2022 14:09:17 +0000 (15:09 +0100)
If scandir(3) returns 0, the uninitialized value of execute_result will
be returned.

lib/run_part.c

index 884bbefab217134407fb59897dcee515c9f848ef..1e4f154b3c475880ab292f12209942ac88c57609 100644 (file)
@@ -48,7 +48,7 @@ int run_parts (const char *directory, const char *name, const char *action)
        int execute_result;
 
        scanlist = scandir (directory, &namelist, 0, alphasort);
-       if (scanlist<0) {
+       if (scanlist<=0) {
                return (0);
        }