aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-08-26 17:33:42 -0700
committerRob Landley <rob@landley.net>2021-08-27 08:56:43 -0500
commit0737ba9e8dd19c101bee7798170a7ad8f5c90c40 (patch)
treeab567eefcaa4ed41fa38f65bfa280919b5b464ad
parent366d5a96b041ebcd71e44249fb1472e27ea0c705 (diff)
downloadtoybox-0737ba9e8dd19c101bee7798170a7ad8f5c90c40.tar.gz
kill: allow `kill -0` for testing process existence.
Allow num_to_sig(0) so kill doesn't disallow -0 because it can't round-trip, and then teach list_signals() to avoid the special case of signal 0 rather than assume that all the signals it shouldn't print don't have names now signal 0 has the name "0".
-rw-r--r--lib/lib.c2
-rw-r--r--lib/portability.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 81c89650..332a0d01 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -931,7 +931,7 @@ void sigatexit(void *handler)
// Output a nicely formatted table of all the signals.
void list_signals(void)
{
- int i = 0, count = 0;
+ int i = 1, count = 0;
unsigned cols = 80;
char *name;
diff --git a/lib/portability.c b/lib/portability.c
index f97af60e..c95a7526 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -422,6 +422,7 @@ int posix_fallocate(int fd, off_t offset, off_t length)
#define SIGNIFY(x) {SIG##x, #x}
static const struct signame signames[] = {
+ {0, "0"},
// POSIX
SIGNIFY(ABRT), SIGNIFY(ALRM), SIGNIFY(BUS),
SIGNIFY(FPE), SIGNIFY(HUP), SIGNIFY(ILL), SIGNIFY(INT), SIGNIFY(KILL),