summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-07-11 14:33:38 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-12 04:47:19 +0200
commit7eedec7307dd5d1f4f4ad1b61b01e7283856388b (patch)
tree49d139dd2899e37163efacf422cc71d6eb827a93
parentimport-creds: when we hit ENOENT on SMBIOS 11 do not even debug log (diff)
downloadsystemd-7eedec7307dd5d1f4f4ad1b61b01e7283856388b.tar.xz
systemd-7eedec7307dd5d1f4f4ad1b61b01e7283856388b.zip
manager: move is-system check into manager_enable_special_signals()
It's usually how we do this: make the functions robust to be called in any context, and validate the context in the functions themselves early, instead of in the caller.
-rw-r--r--src/core/manager.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index f5588380d6..1504d3fd7d 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -477,12 +477,12 @@ static int manager_setup_timezone_change(Manager *m) {
return 0;
}
-static int enable_special_signals(Manager *m) {
+static int manager_enable_special_signals(Manager *m) {
_cleanup_close_ int fd = -EBADF;
assert(m);
- if (MANAGER_IS_TEST_RUN(m))
+ if (!MANAGER_IS_SYSTEM(m) || MANAGER_IS_TEST_RUN(m))
return 0;
/* Enable that we get SIGINT on control-alt-del. In containers this will fail with EPERM (older) or
@@ -608,10 +608,7 @@ static int manager_setup_signals(Manager *m) {
(void) sd_notify(/* unset_environment= */ false,
"X_SYSTEMD_SIGNALS_LEVEL=2");
- if (MANAGER_IS_SYSTEM(m))
- return enable_special_signals(m);
-
- return 0;
+ return manager_enable_special_signals(m);
}
static char** sanitize_environment(char **l) {