From b2bc1f692736debf3ba94872db73435d114d19ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Mon, 3 Jan 2022 13:12:31 +0100
Subject: [PATCH] Do not return garbage in run_parts
 
If scandir(3) returns 0, the uninitialized value of execute_result will
be returned.
 
Reference: https://github.com/shadow-maint/shadow/commit/b2bc1f692736debf3ba94872db73435d114d19ec
Conflict: NA
 
---
 lib/run_part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/lib/run_part.c b/lib/run_part.c
index 884bbefa..1e4f154b 100644
--- a/lib/run_part.c
+++ b/lib/run_part.c
@@ -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);
 	}
 
-- 
2.27.0
 
