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:
rnordier 1998-10-29 11:39:39 +00:00
parent dce7995d53
commit 042df0ac22

View File

@ -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));