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:
Robert Nordier 1998-10-29 11:39:39 +00:00
parent 0d5a725446
commit d223b5868e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40727

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