Call __strsignal() instead of accessing sys_siglist[] directly.

This commit is contained in:
jtc 1994-10-06 18:07:45 +00:00
parent 4b8d7f5ee1
commit f5e46c89f4
1 changed files with 6 additions and 6 deletions

View File

@ -33,29 +33,29 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)psignal.c 5.6 (Berkeley) 2/23/91";*/ /*static char *sccsid = "from: @(#)psignal.c 5.6 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: psignal.c,v 1.5 1994/06/26 16:13:06 jtc Exp $"; static char *rcsid = "$Id: psignal.c,v 1.6 1994/10/06 18:07:45 jtc Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
/* /*
* Print the name of the signal indicated * Print the name of the signal indicated
* along with the supplied message. * along with the supplied message.
*/ */
#include <sys/signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
extern char *__strsignal __P((int , char *));
void void
psignal(sig, s) psignal(sig, s)
unsigned int sig; unsigned int sig;
const char *s; const char *s;
{ {
static char buf[128];
register const char *c; register const char *c;
register int n; register int n;
if (sig < NSIG) c = __strsignal(sig, buf);
c = sys_siglist[sig];
else
c = "Unknown signal";
if (s && *s) { if (s && *s) {
n = strlen(s); n = strlen(s);
(void)write(STDERR_FILENO, s, n); (void)write(STDERR_FILENO, s, n);