Merge "init: fix variable scope issue with ExpandArgs()" into oc-mr1-dev
diff --git a/init/init.cpp b/init/init.cpp
index 9671560..58f5f23 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -948,7 +948,7 @@
}
}
-static void install_reboot_signal_handlers() {
+static void InstallRebootSignalHandlers() {
// Instead of panic'ing the kernel as is the default behavior when init crashes,
// we prefer to reboot to bootloader on development builds, as this will prevent
// boot looping bad configurations and allow both developers and test farms to easily
@@ -956,7 +956,13 @@
struct sigaction action;
memset(&action, 0, sizeof(action));
sigfillset(&action.sa_mask);
- action.sa_handler = [](int) {
+ action.sa_handler = [](int signal) {
+ // These signal handlers are also caught for processes forked from init, however we do not
+ // want them to trigger reboot, so we directly call _exit() for children processes here.
+ if (getpid() != 1) {
+ _exit(signal);
+ }
+
// panic() reboots to bootloader
panic();
};
@@ -983,7 +989,7 @@
}
if (REBOOT_BOOTLOADER_ON_PANIC) {
- install_reboot_signal_handlers();
+ InstallRebootSignalHandlers();
}
add_environment("PATH", _PATH_DEFPATH);