diff options
author | Denis Vlasenko | 2008-02-24 13:36:01 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-02-24 13:36:01 +0000 |
commit | 400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1 (patch) | |
tree | aa3cdc9a663f1ac2467803fc215899d86ed1db74 /miscutils/less.c | |
parent | d553faf5a53cf9d72e16fc789451a92a797f1b70 (diff) | |
download | busybox-400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1.zip busybox-400d8bb45ee25ce226bb343a3dfaab84e6d3a8e1.tar.gz |
less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index f3be2cf..7351a63 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -174,7 +174,9 @@ static void less_exit(int code) { bb_putchar('\n'); set_tty_cooked(); - exit(code); /* TODO: "suicide mode" for code == -signal */ + if (code < 0) + kill_myself_with_sig(- code); /* does not return */ + exit(code); } /* Move the cursor to a position (x,y), where (0,0) is the @@ -1328,9 +1330,9 @@ static void keypress_process(int keypress) number_process(keypress); } -static void sig_catcher(int sig ATTRIBUTE_UNUSED) +static void sig_catcher(int sig) { - less_exit(1) /* TODO: "suicide mode" for code == -signal */ + less_exit(- sig); } int less_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |