summaryrefslogtreecommitdiff
path: root/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-02-13 01:17:08 +0100
committerLennart Poettering <lennart@poettering.net>2010-02-13 01:17:08 +0100
commit84e9af1e01bfcc3ce9897c62aa76d356e97aa092 (patch)
treedff6930d46be73ece4b2fd5238251ed7c78e559b /manager.c
parent036643a247c659db8e1b3df1778d51553a816ec9 (diff)
manager: run ctrl-alt-del/kbrequest targets on SIGINT/SIGWINCH when run in init mode
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/manager.c b/manager.c
index bec1398887..68a662826a 100644
--- 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));