summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-07-22 11:47:42 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-07-22 11:48:26 +0200
commitdf5b65e15d965e54ef747157ba031430c2c60fd6 (patch)
treee94258df8e596fadf7d2f96914660b4b0b7e5bf5 /src/shared
parentrepart: use new style for pointers in function signatures (diff)
downloadsystemd-df5b65e15d965e54ef747157ba031430c2c60fd6.tar.xz
systemd-df5b65e15d965e54ef747157ba031430c2c60fd6.zip
shared/exec-util: add macro to autoinsert sentinel for fork_agent()
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ask-password-agent.c3
-rw-r--r--src/shared/exec-util.c2
-rw-r--r--src/shared/exec-util.h3
-rw-r--r--src/shared/polkit-agent.c6
4 files changed, 7 insertions, 7 deletions
diff --git a/src/shared/ask-password-agent.c b/src/shared/ask-password-agent.c
index 75eaa46254..60281d3ae9 100644
--- a/src/shared/ask-password-agent.c
+++ b/src/shared/ask-password-agent.c
@@ -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");
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index b02361a579..213d660a2e 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -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;
diff --git a/src/shared/exec-util.h b/src/shared/exec-util.h
index 6c2d6b19cd..3940a286ae 100644
--- a/src/shared/exec-util.h
+++ b/src/shared/exec-util.h
@@ -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)
diff --git a/src/shared/polkit-agent.c b/src/shared/polkit-agent.c
index 93c15c29e7..2f38965cf2 100644
--- a/src/shared/polkit-agent.c
+++ b/src/shared/polkit-agent.c
@@ -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]);