From: Mike Yuan Date: Sun, 28 Jan 2024 16:17:09 +0000 (+0800) Subject: notify: if execve() failed, always show original error X-Git-Tag: v256-rc1~1016^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3158ff36e77318a51618697902b5d2be228b101;p=thirdparty%2Fsystemd.git notify: if execve() failed, always show original error --- diff --git a/src/notify/notify.c b/src/notify/notify.c index 620f64a3ef5..9251ff280b2 100644 --- a/src/notify/notify.c +++ b/src/notify/notify.c @@ -448,15 +448,10 @@ static int run(int argc, char* argv[]) { } if (arg_exec) { - _cleanup_free_ char *cmdline = NULL; - execvp(arg_exec[0], arg_exec); - cmdline = strv_join(arg_exec, " "); - if (!cmdline) - return log_oom(); - - return log_error_errno(errno, "Failed to execute command line: %s", cmdline); + _cleanup_free_ char *cmdline = strv_join(arg_exec, " "); + return log_error_errno(errno, "Failed to execute command line: %s", strnull(cmdline)); } /* The DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() boilerplate will send the exit status via