hostnamed: port to sd_event_set_signal_exit()

This commit is contained in:
Lennart Poettering
2024-01-08 13:51:44 +01:00
parent d7d6195953
commit aefaeebef3

View File

@@ -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);
r = sd_event_set_signal_exit(event, true);
if (r < 0)
return log_error_errno(r, "Failed to install SIGINT handler: %m");
r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
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)