strace: fix-up bad signal name table

This commit is contained in:
K Lange 2021-09-26 22:07:03 +09:00
parent a6f063b06d
commit a9152c55c4

View File

@ -303,10 +303,11 @@ const char * errno_names[256] = {
M(ENOTRECOVERABLE), M(ENOTRECOVERABLE),
M(EOWNERDEAD), M(EOWNERDEAD),
M(ESTRPIPE), M(ESTRPIPE),
0
}; };
const char * signal_names[256] = { const char * signal_names[NSIG] = {
M(SIGHUP), M(SIGHUP),
M(SIGINT), M(SIGINT),
M(SIGQUIT), M(SIGQUIT),
@ -343,6 +344,7 @@ const char * signal_names[256] = {
M(SIGHATE), M(SIGHATE),
M(SIGWINEVENT), M(SIGWINEVENT),
M(SIGCAT), M(SIGCAT),
M(SIGTTOU),
}; };
#if 0 #if 0
@ -562,7 +564,7 @@ static void struct_timeval_arg(pid_t pid, uintptr_t ptr) {
} }
static void signal_arg(int signum) { static void signal_arg(int signum) {
if (signum >= 0 && signum < 256) { if (signum >= 0 && signum < NSIG && signal_names[signum]) {
fprintf(logfile, "%s", signal_names[signum]); fprintf(logfile, "%s", signal_names[signum]);
} else { } else {
fprintf(logfile, "%d", signum); fprintf(logfile, "%d", signum);