]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/exec-util: add macro to autoinsert sentinel for fork_agent() 33804/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 22 Jul 2024 09:47:42 +0000 (11:47 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 22 Jul 2024 09:48:26 +0000 (11:48 +0200)
src/shared/ask-password-agent.c
src/shared/exec-util.c
src/shared/exec-util.h
src/shared/polkit-agent.c

index 75eaa46254261a3ca250b4482a0136bee0b2a556..60281d3ae94c5d8de2ff6042a24967d6ff91114c 100644 (file)
@@ -29,7 +29,8 @@ int ask_password_agent_open(void) {
                        NULL, 0,
                        &agent_pid,
                        SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH,
-                       SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, "--watch", NULL);
+                       SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH,
+                       "--watch");
         if (r < 0)
                 return log_error_errno(r, "Failed to fork TTY ask password agent: %m");
 
index b02361a57916c40261d1da40d21e870d87da1328..213d660a2e2904b203d5d3d2d1b00891049e2545 100644 (file)
@@ -531,7 +531,7 @@ int fexecve_or_execve(int executable_fd, const char *executable, char *const arg
         return -errno;
 }
 
-int fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) {
+int _fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) {
         bool stdout_is_tty, stderr_is_tty;
         size_t n, i;
         va_list ap;
index 6c2d6b19cdebad2682e14370811de45d12a4f590..3940a286aea147d017a99ef54aa1a55928643ca8 100644 (file)
@@ -61,4 +61,5 @@ ExecCommandFlags exec_command_flags_from_string(const char *s);
 
 int fexecve_or_execve(int executable_fd, const char *executable, char *const argv[], char *const envp[]);
 
-int fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) _sentinel_;
+int _fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) _sentinel_;
+#define fork_agent(name, ...) _fork_agent(name, __VA_ARGS__, NULL)
index 93c15c29e76cd4d7535f1e74ef275a1b289a302b..2f38965cf276459b224c109912a124e57e0712f3 100644 (file)
@@ -48,10 +48,8 @@ int polkit_agent_open(void) {
                        &agent_pid,
                        POLKIT_AGENT_BINARY_PATH,
                        POLKIT_AGENT_BINARY_PATH,
-                       "--notify-fd",
-                       notify_fd,
-                       "--fallback",
-                       NULL);
+                       "--notify-fd", notify_fd,
+                       "--fallback");
 
         /* Close the writing side, because that's the one for the agent */
         safe_close(pipe_fd[1]);