Use nsig instead of arbitrary numbers

* filter_qualify.c (sigstr_to_uint): Use nsig.
* prctl.c (SYS_FUNC(prctl)) <case PR_SET_PDEATHSIG>: Use nsig.
This commit is contained in:
Eugene Syromyatnikov 2018-09-27 07:56:25 +02:00
parent 6d024c6336
commit bca1b70f6b
2 changed files with 3 additions and 3 deletions

View File

@ -52,12 +52,12 @@ static int
sigstr_to_uint(const char *s) sigstr_to_uint(const char *s)
{ {
if (*s >= '0' && *s <= '9') if (*s >= '0' && *s <= '9')
return string_to_uint_upto(s, 255); return string_to_uint_upto(s, nsig);
if (strncasecmp(s, "SIG", 3) == 0) if (strncasecmp(s, "SIG", 3) == 0)
s += 3; s += 3;
for (int i = 0; i <= 255; ++i) { for (size_t i = 0; i <= nsig; i++) {
const char *name = signame(i); const char *name = signame(i);
if (strncasecmp(name, "SIG", 3) != 0) if (strncasecmp(name, "SIG", 3) != 0)

View File

@ -335,7 +335,7 @@ SYS_FUNC(prctl)
case PR_SET_PDEATHSIG: case PR_SET_PDEATHSIG:
tprints(", "); tprints(", ");
if (arg2 > 128) if (arg2 > nsig)
tprintf("%" PRI_klu, arg2); tprintf("%" PRI_klu, arg2);
else else
tprints(signame(arg2)); tprints(signame(arg2));