]> err.no Git - systemd/commitdiff
manager: run ctrl-alt-del/kbrequest targets on SIGINT/SIGWINCH when run in init mode
authorLennart Poettering <lennart@poettering.net>
Sat, 13 Feb 2010 00:17:08 +0000 (01:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 13 Feb 2010 00:17:08 +0000 (01:17 +0100)
manager.c

index bec13988873b3386b4d58061d3fce15f9e0917f0..68a662826af90161310b66435d7de0d79938d03d 100644 (file)
--- a/manager.c
+++ b/manager.c
@@ -1353,8 +1353,40 @@ static int manager_process_signal_fd(Manager *m, bool *quit) {
 
                 case SIGINT:
                 case SIGTERM:
-                        *quit = true;
-                        return 0;
+
+                        if (m->running_as != MANAGER_INIT) {
+                                *quit = true;
+                                return 0;
+
+                        } else {
+                                Unit *target;
+                                int r;
+
+                                if ((r = manager_load_unit(m, SPECIAL_CTRL_ALT_DEL_TARGET, &target)) < 0)
+                                        log_error("Failed to load ctrl-alt-del target: %s", strerror(-r));
+                                else if ((r = manager_add_job(m, JOB_START, target, JOB_REPLACE, true, NULL)) < 0)
+                                        log_error("Failed to enqueue ctrl-alt-del job: %s", strerror(-r));
+
+                                break;
+                        }
+
+                case SIGWINCH:
+
+                        if (m->running_as == MANAGER_INIT) {
+                                Unit *target;
+                                int r;
+
+                                if ((r = manager_load_unit(m, SPECIAL_KBREQUEST_TARGET, &target)) < 0)
+                                        log_error("Failed to load kbrequest target: %s", strerror(-r));
+                                else if ((r = manager_add_job(m, JOB_START, target, JOB_REPLACE, true, NULL)) < 0)
+                                        log_error("Failed to enqueue kbrequest job: %s", strerror(-r));
+
+                                break;
+                        }
+
+                        /* This is a nop on non-init systemd's */
+
+                        break;
 
                 default:
                         log_info("Got unhandled signal <%s>.", strsignal(sfsi.ssi_signo));