]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
notify: if execve() failed, always show original error
authorMike Yuan <me@yhndnzj.com>
Sun, 28 Jan 2024 16:17:09 +0000 (00:17 +0800)
committerMike Yuan <me@yhndnzj.com>
Mon, 29 Jan 2024 19:27:36 +0000 (03:27 +0800)
src/notify/notify.c

index 620f64a3ef53266c308924ce5e8c7960d366cbb2..9251ff280b20c14a2f2281e35c847ea602a4cdd8 100644 (file)
@@ -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