Use sys_nsig instead of NSIG for the length of the signal arrays. This
is important if we add new signals later. From DragonflyBSD: jobs.c:1.4, trap.c:1.3. Obtained from: DragonflyBSD
This commit is contained in:
parent
fbcf5e6575
commit
1b13752a03
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125155
@ -362,7 +362,7 @@ showjob(struct job *jp, pid_t pid, int sformat, int lformat)
|
||||
else
|
||||
#endif
|
||||
i = WTERMSIG(ps->status);
|
||||
if ((i & 0x7F) < NSIG && sys_siglist[i & 0x7F])
|
||||
if ((i & 0x7F) < sys_nsig && sys_siglist[i & 0x7F])
|
||||
scopy(sys_siglist[i & 0x7F], s);
|
||||
else
|
||||
fmtstr(s, 64, "Signal %d", i & 0x7F);
|
||||
@ -985,7 +985,7 @@ dowait(int block, struct job *job)
|
||||
if (!mflag ||
|
||||
(thisjob->foreground && !WIFSTOPPED(status))) {
|
||||
i = WTERMSIG(status);
|
||||
if ((i & 0x7F) < NSIG && sys_siglist[i & 0x7F])
|
||||
if ((i & 0x7F) < sys_nsig && sys_siglist[i & 0x7F])
|
||||
out1str(sys_siglist[i & 0x7F]);
|
||||
else
|
||||
out1fmt("Signal %d", i & 0x7F);
|
||||
|
@ -106,8 +106,8 @@ sigstring_to_signum(char *sig)
|
||||
|
||||
if (strncasecmp(sig, "sig", 3) == 0)
|
||||
sig += 3;
|
||||
for (n = 1; n < NSIG; n++)
|
||||
if (strcasecmp(sys_signame[n], sig) == 0)
|
||||
for (n = 1; n < sys_nsig; n++)
|
||||
if (sys_signame[n] && strcasecmp(sys_signame[n], sig) == 0)
|
||||
return (n);
|
||||
}
|
||||
return (-1);
|
||||
@ -122,7 +122,7 @@ printsignals(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n = 1; n < NSIG; n++) {
|
||||
for (n = 1; n < sys_nsig; n++) {
|
||||
out1fmt("%s", sys_signame[n]);
|
||||
if (n == (NSIG / 2) || n == (NSIG - 1))
|
||||
out1str("\n");
|
||||
@ -142,7 +142,7 @@ trapcmd(int argc, char **argv)
|
||||
int signo;
|
||||
|
||||
if (argc <= 1) {
|
||||
for (signo = 0 ; signo < NSIG ; signo++) {
|
||||
for (signo = 0 ; signo < sys_nsig ; signo++) {
|
||||
if (trap[signo] != NULL)
|
||||
out1fmt("trap -- '%s' %s\n", trap[signo],
|
||||
(signo) ? sys_signame[signo] : "exit");
|
||||
|
Loading…
Reference in New Issue
Block a user