]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
exec-util: propagate error in wait_for_terminate_and_check()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Feb 2023 16:55:28 +0000 (01:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 19 Feb 2023 03:17:52 +0000 (12:17 +0900)
Then, the two error handlings becomes consistent with the one in
execute_directories().

src/shared/exec-util.c

index 7ed2cce76b9a211cd5c3c27118f228eb9b8c6bb2..51234fd02514899a3f5f651f2103ad5e798efc08 100644 (file)
@@ -151,10 +151,9 @@ static int do_execute(
                         t = NULL;
                 } else {
                         r = wait_for_terminate_and_check(t, pid, WAIT_LOG);
-                        if (FLAGS_SET(flags, EXEC_DIR_IGNORE_ERRORS)) {
-                                if (r < 0)
-                                        continue;
-                        } else if (r > 0)
+                        if (r < 0)
+                                return r;
+                        if (!FLAGS_SET(flags, EXEC_DIR_IGNORE_ERRORS) && r > 0)
                                 return r;
 
                         if (callbacks) {
@@ -186,6 +185,8 @@ static int do_execute(
                 assert(t);
 
                 r = wait_for_terminate_and_check(t, pid, WAIT_LOG);
+                if (r < 0)
+                        return r;
                 if (!FLAGS_SET(flags, EXEC_DIR_IGNORE_ERRORS) && r > 0)
                         return r;
         }