The man page implies that the string argument to psignal() may be
NULL, in line with perror(3). However, the code presently checks only for a zero-length string. Check for both.
This commit is contained in:
parent
dce7995d53
commit
042df0ac22
@ -49,15 +49,13 @@ psignal(sig, s)
|
||||
const char *s;
|
||||
{
|
||||
register const char *c;
|
||||
register int n;
|
||||
|
||||
if (sig < NSIG)
|
||||
c = sys_siglist[sig];
|
||||
else
|
||||
c = "Unknown signal";
|
||||
n = strlen(s);
|
||||
if (n) {
|
||||
(void)write(STDERR_FILENO, s, n);
|
||||
if (s != NULL && *s != '\0') {
|
||||
(void)write(STDERR_FILENO, s, strlen(s));
|
||||
(void)write(STDERR_FILENO, ": ", 2);
|
||||
}
|
||||
(void)write(STDERR_FILENO, c, strlen(c));
|
||||
|
Loading…
Reference in New Issue
Block a user