From 802642ada1acd23fb4559678a916d2c00f6d1355 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 5 Aug 2015 21:39:53 -0500 Subject: [PATCH] Minor tweak of reboot.c --- toys/other/reboot.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/toys/other/reboot.c b/toys/other/reboot.c index 9193ba4..1e8f5e9 100644 --- a/toys/other/reboot.c +++ b/toys/other/reboot.c @@ -24,13 +24,12 @@ config REBOOT void reboot_main(void) { - int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF}; - int sigs[] = {SIGINT, SIGUSR1, SIGUSR2}; + int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF}, + sigs[] = {SIGINT, SIGUSR1, SIGUSR2}, idx; if (!(toys.optflags & FLAG_n)) sync(); - if (toys.optflags & FLAG_f) - toys.exitval = reboot(types[stridx("hp", *toys.which->name)+1]); - else - toys.exitval = kill(1, sigs[stridx("hp", *toys.which->name)+1]); + idx = stridx("hp", *toys.which->name)+1; + if (toys.optflags & FLAG_f) toys.exitval = reboot(types[idx]); + else toys.exitval = kill(1, sigs[idx]); } -- 2.7.4