summaryrefslogtreecommitdiffstats
path: root/bin/sh/trap.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-01-28 19:01:10 +0000
committernjl <njl@FreeBSD.org>2004-01-28 19:01:10 +0000
commit8d164f018ebe5312b6a40e08483d4a9d1fcd3156 (patch)
tree9c43155da1a79306c409066cbffcbfbd3f8b3e1a /bin/sh/trap.c
parentdb65d6a17c8bc08c56b292a98c96196008eeb3e1 (diff)
downloadFreeBSD-src-8d164f018ebe5312b6a40e08483d4a9d1fcd3156.zip
FreeBSD-src-8d164f018ebe5312b6a40e08483d4a9d1fcd3156.tar.gz
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
Diffstat (limited to 'bin/sh/trap.c')
-rw-r--r--bin/sh/trap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index f848ee1..f00c6d5 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -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");
OpenPOWER on IntegriCloud