Skip to content

Commit

Permalink
kill: allow kill -0 for testing process existence.
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
enh-google authored and landley committed Aug 27, 2021
1 parent 366d5a9 commit 0737ba9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions lib/portability.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 0737ba9

Please sign in to comment.