1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

exec-util: use strv_from_stdarg_alloca()

No functional change, just refactoring.
This commit is contained in:
Yu Watanabe 2024-12-01 17:43:31 +09:00
parent f0ace1655d
commit 46c26454bd
3 changed files with 1 additions and 19 deletions

View File

@ -25,7 +25,6 @@ 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");
if (r < 0)
return log_error_errno(r, "Failed to fork TTY ask password agent: %m");

View File

@ -561,9 +561,6 @@ int shall_fork_agent(void) {
}
int _fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) {
size_t n, i;
va_list ap;
char **l;
int r;
assert(path);
@ -619,20 +616,7 @@ int _fork_agent(const char *name, const int except[], size_t n_except, pid_t *re
}
/* Count arguments */
va_start(ap, path);
for (n = 0; va_arg(ap, char*); n++)
;
va_end(ap);
/* Allocate strv */
l = newa(char*, n + 1);
/* Fill in arguments */
va_start(ap, path);
for (i = 0; i <= n; i++)
l[i] = va_arg(ap, char*);
va_end(ap);
char **l = strv_from_stdarg_alloca(path);
execv(path, l);
log_error_errno(errno, "Failed to execute %s: %m", path);
_exit(EXIT_FAILURE);

View File

@ -45,7 +45,6 @@ int polkit_agent_open(void) {
1,
&agent_pid,
POLKIT_AGENT_BINARY_PATH,
POLKIT_AGENT_BINARY_PATH,
"--notify-fd", notify_fd,
"--fallback");
if (r < 0)