]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-path: guarantee that tool exit status is zero on success
authorLennart Poettering <lennart@poettering.net>
Tue, 10 Dec 2024 13:05:04 +0000 (14:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Dec 2024 16:51:50 +0000 (17:51 +0100)
Let's not inherit the error code from an earlier function invocation.

src/path/path.c

index 604e4c170b63602271840c0a9ddea13111f82cd4..8abfc6c7f2b0a9bdf4a797fd2a5c063c72d6d923 100644 (file)
@@ -238,10 +238,11 @@ static int run(int argc, char* argv[]) {
         if (r <= 0)
                 return r;
 
-        if (argc > optind)
+        if (argc > optind) {
+                r = 0;
                 for (int i = optind; i < argc; i++)
                         RET_GATHER(r, print_path(argv[i]));
-        else
+        else
                 r = list_paths();
 
         return r;