diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-01-08 13:51:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-01-09 10:46:01 +0100 |
commit | aefaeebef396366696d98da58982fbfd0592e2a1 (patch) | |
tree | 21725f8fda5e234b39d78e80fa292e1159d7a1fd /src/hostname | |
parent | cocci: merge mfree.cocci and mfree_return.cocci (#30838) (diff) | |
download | systemd-aefaeebef396366696d98da58982fbfd0592e2a1.tar.xz systemd-aefaeebef396366696d98da58982fbfd0592e2a1.zip |
hostnamed: port to sd_event_set_signal_exit()
Diffstat (limited to 'src/hostname')
-rw-r--r-- | src/hostname/hostnamed.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index d629a07d0f..a5cac8b620 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -1615,21 +1615,15 @@ static int run(int argc, char *argv[]) { if (r < 0) return r; - assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0); - r = sd_event_default(&event); if (r < 0) return log_error_errno(r, "Failed to allocate event loop: %m"); (void) sd_event_set_watchdog(event, true); - r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL); - if (r < 0) - return log_error_errno(r, "Failed to install SIGINT handler: %m"); - - r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL); + r = sd_event_set_signal_exit(event, true); if (r < 0) - return log_error_errno(r, "Failed to install SIGTERM handler: %m"); + return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m"); r = connect_bus(&context, event, &bus); if (r < 0) |