From 7cbe71b74d3bd8b8de8f6838934eaaa5365c4e61 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 7 Sep 2015 09:44:05 -0700 Subject: kill function returns boolean rather than integer. * signal.c (kill_wrap): Return boolean indication of success, with compatibility to previous behavior. * txr.1: Document return value of kill, and put in compatibility note. --- signal.c | 6 +++++- txr.1 | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/signal.c b/signal.c index e5649f7a..b5f8f464 100644 --- a/signal.c +++ b/signal.c @@ -42,6 +42,7 @@ #include "signal.h" #include "unwind.h" #include "eval.h" +#include "txr.h" #define MAX_SIG 32 @@ -113,7 +114,10 @@ static void sig_handler(int sig) static val kill_wrap(val pid, val sig) { cnum p = c_num(pid), s = c_num(default_arg(sig, num_fast(SIGTERM))); - return num(kill(p, s)); + int res = kill(p, s); + if (opt_compat && opt_compat <= 114) + return num(res); + return tnil(res == 0); } static val raise_wrap(val sig) diff --git a/txr.1 b/txr.1 index 067bbb7b..334b5640 100644 --- a/txr.1 +++ b/txr.1 @@ -31319,6 +31319,11 @@ If the argument is omitted, it defaults to the same value as .codn sig-term . +The return value is +.code t +if the function succeeds, otherwise +.codn nil . + .SS* Unix Processes .coNP Functions @ fork and @ wait @@ -33290,7 +33295,12 @@ selects the behaviors described below for version 105, but not those for 102. .cble The new format omits the program name prefix and parentheses. - +Also, the +.code kill +function returned an integer, obtained from the return +value of the underlying C function, rather than converting +that value to a boolean. The old behavior was not documented, +and 114 compatibility restores it. .IP 113 Version 113 is the last version in which the -- cgit v1.2.3