Don't pass negative values into <ctype.h> functions on machines
with signed chars.
This commit is contained in:
parent
ee6b783c62
commit
fe1ba53cff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132193
@ -67,7 +67,7 @@ upper(const char *str)
|
|||||||
strncpy(buf, str, sizeof(buf));
|
strncpy(buf, str, sizeof(buf));
|
||||||
buf[sizeof(buf) - 1] = '\0';
|
buf[sizeof(buf) - 1] = '\0';
|
||||||
for (s = buf; *s; s++)
|
for (s = buf; *s; s++)
|
||||||
*s = toupper(*s);
|
*s = toupper((unsigned char)*s);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ main(int ac, char **av)
|
|||||||
zflag++;
|
zflag++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isalpha(**av)) {
|
if (isalpha((unsigned char)**av)) {
|
||||||
if (strncasecmp(*av, "sig", 3) == 0)
|
if (strncasecmp(*av, "sig", 3) == 0)
|
||||||
*av += 3;
|
*av += 3;
|
||||||
for (sig = NSIG, p = sys_signame + 1;
|
for (sig = NSIG, p = sys_signame + 1;
|
||||||
@ -217,7 +217,7 @@ main(int ac, char **av)
|
|||||||
}
|
}
|
||||||
if (!sig)
|
if (!sig)
|
||||||
nosig(*av);
|
nosig(*av);
|
||||||
} else if (isdigit(**av)) {
|
} else if (isdigit((unsigned char)**av)) {
|
||||||
sig = strtol(*av, &ep, 10);
|
sig = strtol(*av, &ep, 10);
|
||||||
if (!*av || *ep)
|
if (!*av || *ep)
|
||||||
errx(1, "illegal signal number: %s", *av);
|
errx(1, "illegal signal number: %s", *av);
|
||||||
|
Loading…
Reference in New Issue
Block a user