hostnamed,localed,timedate: properly propagate errors from sd_event_add_signal()

main() can't doesn't expect negative error codes as return.
This commit is contained in:
Lennart Poettering 2018-11-12 13:31:03 +01:00
parent cd0504a395
commit 4b670f8688
3 changed files with 24 additions and 12 deletions

View File

@ -732,12 +732,16 @@ int main(int argc, char *argv[]) {
(void) sd_event_set_watchdog(event, true);
r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGINT handler: %m");
goto finish;
}
r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGTERM handler: %m");
goto finish;
}
r = connect_bus(&context, event, &bus);
if (r < 0)

View File

@ -751,12 +751,16 @@ int main(int argc, char *argv[]) {
(void) sd_event_set_watchdog(event, true);
r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGINT handler: %m");
goto finish;
}
r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGTERM handler: %m");
goto finish;
}
r = connect_bus(&context, event, &bus);
if (r < 0)

View File

@ -987,12 +987,16 @@ int main(int argc, char *argv[]) {
(void) sd_event_set_watchdog(event, true);
r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGINT handler: %m");
goto finish;
}
r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
if (r < 0)
return r;
if (r < 0) {
log_error_errno(r, "Failed to install SIGTERM handler: %m");
goto finish;
}
r = connect_bus(&context, event, &bus);
if (r < 0)