summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-13 04:07:19 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-13 04:07:19 +0200
commit8c43883a682b2edd902b170ab2e0f3d50d7e92e0 (patch)
tree5f8f89685b7cbb560bc919f6d85cef6793b0355f
parent243b1432c6c9e2b92e9fc948e119ebd6e5f4de2b (diff)
main: try to block signals before executing crash shell
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.c b/main.c
index 3e2bfe10ca..6a3eee2eb0 100644
--- 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));
}