process-util: rework wait_for_terminate_and_warn() to take a flags parameter
This renames wait_for_terminate_and_warn() to wait_for_terminate_and_check(), and adds a flags parameter, that controls how much to log: there's one flag that means we log about abnormal stuff, and another one that controls whether we log about non-zero exit codes. Finally, there's a shortcut flag value for logging in both cases, as that's what we usually use. All callers are accordingly updated. At three occasions duplicate logging is removed, i.e. where the old function was called but logged in the caller, too.
This commit is contained in:
@@ -3556,7 +3556,7 @@ static int load_kexec_kernel(void) {
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return wait_for_terminate_and_warn("kexec", pid, true);
|
||||
return wait_for_terminate_and_check("kexec", pid, WAIT_LOG);
|
||||
}
|
||||
|
||||
static int set_exit_code(uint8_t code) {
|
||||
@@ -7057,9 +7057,9 @@ static int run_editor(char **paths) {
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
r = wait_for_terminate_and_warn("editor", pid, true);
|
||||
r = wait_for_terminate_and_check("editor", pid, WAIT_LOG);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to wait for child: %m");
|
||||
return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user