]> err.no Git - systemd/commitdiff
main: try to block signals before executing crash shell
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Apr 2010 02:07:19 +0000 (04:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Apr 2010 02:07:19 +0000 (04:07 +0200)
main.c

diff --git a/main.c b/main.c
index 3e2bfe10ca94b5ed384a9e6ca205d848c5de8e08..6a3eee2eb0511b6a74c81870d3c184fb48d6c02b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -110,9 +110,17 @@ _noreturn static void crash(int sig) {
                 chvt(crash_chvt);
 
         if (crash_shell) {
+                sigset_t mask;
+
                 log_info("Executing crash shell in 10s...");
                 sleep(10);
 
+                /* Make sure the signal is not delivered inside the
+                 * exec() */
+                assert_se(sigemptyset(&mask) == 0);
+                assert_se(sigaddset(&mask, sig) == 0);
+                assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
+
                 execl("/bin/sh", "/bin/sh", NULL);
                 log_error("execl() failed: %s", strerror(errno));
         }