From 262fa6864b7a94a56c1c65f55d52af6b83ae2f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 14 Jul 2024 14:02:20 +0200 Subject: [PATCH 1/3] selinux-util: add missing char in comment --- src/shared/selinux-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c index e626a60026..e4f6e07e53 100644 --- a/src/shared/selinux-util.c +++ b/src/shared/selinux-util.c @@ -168,7 +168,7 @@ static int selinux_init(bool force) { if (!force && initialized != LAZY_INITIALIZED) return 1; - r = selinux_status_open(/* netlink fallback */ 1); + r = selinux_status_open(/* netlink fallback= */ 1); if (r < 0) { if (!ERRNO_IS_PRIVILEGE(errno)) return log_enforcing_errno(errno, "Failed to open SELinux status page: %m"); From 52031044bfc395fdf8c5ebb68ef6dab4f7316f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 14 Jul 2024 14:29:35 +0200 Subject: [PATCH 2/3] repart: use new style for pointers in function signatures --- src/partition/repart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/partition/repart.c b/src/partition/repart.c index 0ad8fad150..5ba099940a 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -558,7 +558,7 @@ static Partition* partition_unlink_and_free(Context *context, Partition *p) { DEFINE_TRIVIAL_CLEANUP_FUNC(Partition*, partition_free); -static Context *context_new(sd_id128_t seed) { +static Context* context_new(sd_id128_t seed) { Context *context; context = new(Context, 1); @@ -585,7 +585,7 @@ static void context_free_free_areas(Context *context) { context->n_free_areas = 0; } -static Context *context_free(Context *context) { +static Context* context_free(Context *context) { if (!context) return NULL; @@ -3778,7 +3778,7 @@ static const char* partition_target_path(PartitionTarget *t) { return t->path; } -static PartitionTarget *partition_target_free(PartitionTarget *t) { +static PartitionTarget* partition_target_free(PartitionTarget *t) { if (!t) return NULL; From df5b65e15d965e54ef747157ba031430c2c60fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 22 Jul 2024 11:47:42 +0200 Subject: [PATCH 3/3] shared/exec-util: add macro to autoinsert sentinel for fork_agent() --- src/shared/ask-password-agent.c | 3 ++- src/shared/exec-util.c | 2 +- src/shared/exec-util.h | 3 ++- src/shared/polkit-agent.c | 6 ++---- 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]);