aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-08-19 16:22:21 -0500
committerRob Landley <rob@landley.net>2018-08-19 16:22:21 -0500
commit8e221d54c809cdbc5ebfed71abdd4ec27f3cd266 (patch)
treef1948e2d9899eb28f7b7e54b483684bb5589888f /toys
parent2d32142041b644d2e218b1b630d2be3f6a761589 (diff)
downloadtoybox-8e221d54c809cdbc5ebfed71abdd4ec27f3cd266.tar.gz
Oneit shouldn't reboot the system if it's not pid 1.
Diffstat (limited to 'toys')
-rw-r--r--toys/other/oneit.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/other/oneit.c b/toys/other/oneit.c
index 24bd45c6..681eb12f 100644
--- a/toys/other/oneit.c
+++ b/toys/other/oneit.c
@@ -57,6 +57,7 @@ static void oneit_signaled(int signal)
// PID 1 can't call reboot() because it kills the task that calls it,
// which causes the kernel to panic before the actual reboot happens.
sync();
+ if (getpid()!=1) _exit(0);
if (!vfork()) reboot(action);
}