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".
---
lib/lib.c | 2 +-
lib/portability.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
From bd6af9ca1db42b961b23e75e5594f36cbf9d6668 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Thu, 26 Aug 2021 17:33:42 -0700
Subject: [PATCH] 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".
---
lib/lib.c | 2 +-
lib/portability.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
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),
--
2.33.0.259.gc128427fd7-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net