diff options
author | Rob Landley <rob@landley.net> | 2015-08-05 21:39:53 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-08-05 21:39:53 -0500 |
commit | 802642ada1acd23fb4559678a916d2c00f6d1355 (patch) | |
tree | 01dce619a3edf8c8c24fd6cdd0a7204f05811298 | |
parent | a12eec740dc6d0c533fb7d83a0a54de6d3abb17c (diff) | |
download | toybox-802642ada1acd23fb4559678a916d2c00f6d1355.tar.gz toybox-802642ada1acd23fb4559678a916d2c00f6d1355.tar.bz2 toybox-802642ada1acd23fb4559678a916d2c00f6d1355.zip |
Minor tweak of reboot.c
-rw-r--r-- | toys/other/reboot.c | 11 |
1 files 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]); } |