changeset 5579:466bc8ef8e21

(sigchld_handler, status_message): Handle a NULL in sys_siglist.
author Richard M. Stallman <rms@gnu.org>
date Fri, 14 Jan 1994 14:17:12 +0000
parents b785c3474b47
children 517d8eb361f8
files src/process.c
diffstat 1 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Fri Jan 14 14:16:29 1994 +0000
+++ b/src/process.c	Fri Jan 14 14:17:12 1994 +0000
@@ -308,11 +308,18 @@
 
   if (EQ (symbol, Qsignal) || EQ (symbol, Qstop))
     {
+      char *signame = 0;
+      if (code < NSIG)
+	{
 #ifndef VMS
-      string = build_string (code < NSIG ? sys_siglist[code] : "unknown");
+	  signame = sys_siglist[code];
 #else
-      string = build_string (code < NSIG ? sys_errlist[code] : "unknown");
+	  signame = sys_errlist[code];
 #endif
+	}
+      if (signame == 0)
+	signame = "unknown";
+      string = build_string (signame);
       string2 = build_string (coredump ? " (core dumped)\n" : "\n");
       XSTRING (string)->data[0] = DOWNCASE (XSTRING (string)->data[0]);
       return concat2 (string, string2);
@@ -2827,11 +2834,23 @@
 	  if (WIFEXITED (w))
 	    synch_process_retcode = WRETCODE (w);
 	  else if (WIFSIGNALED (w))
+	    {
+	      int code = WTERMSIG (w);
+	      char *signame = 0;
+
+	      if (code < NSIG)
+		{
 #ifndef VMS
-	    synch_process_death = (char *) sys_siglist[WTERMSIG (w)];
+		  signame = sys_siglist[code];
 #else
-	    synch_process_death = sys_errlist[WTERMSIG (w)];
+		  signame = sys_errlist[code];
 #endif
+		}
+	      if (signame == 0)
+		signame = "unknown";
+
+	      synch_process_death = signame;
+	    }
 
 	  /* Tell wait_reading_process_input that it needs to wake up and
 	     look around.  */