From: Yu Watanabe Date: Sat, 18 Feb 2023 16:55:28 +0000 (+0900) Subject: exec-util: propagate error in wait_for_terminate_and_check() X-Git-Tag: v254-rc1~1233^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=65cd9c7251384f7af934f8d928118b2d4829ee6c;p=thirdparty%2Fsystemd.git exec-util: propagate error in wait_for_terminate_and_check() Then, the two error handlings becomes consistent with the one in execute_directories(). --- diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c index 7ed2cce76b9..51234fd0251 100644 --- a/src/shared/exec-util.c +++ b/src/shared/exec-util.c @@ -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; }