changeset 9593:68882a46b5fc

[SYSV_IPC] (main): Catch SIGHUP as well. Don't call kill with pid 0. Handle EINTR when receiving messages.
author Richard M. Stallman <rms@gnu.org>
date Tue, 18 Oct 1994 11:23:18 +0000
parents 132798b0352b
children 7461e7aa4f3c
files lib-src/emacsserver.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/emacsserver.c	Tue Oct 18 07:36:39 1994 +0000
+++ b/lib-src/emacsserver.c	Tue Oct 18 11:23:18 1994 +0000
@@ -252,6 +252,11 @@
 #include <sys/ipc.h>
 #include <sys/msg.h>
 #include <setjmp.h>
+#include <errno.h>
+
+#ifndef errno
+extern int errno;
+#endif
 
 jmp_buf msgenv;
 
@@ -303,11 +308,13 @@
   if (setjmp (msgenv))
     {
       msgctl (s, IPC_RMID, 0);
-      kill (p, SIGKILL);
+      if (p > 0)
+	kill (p, SIGKILL);
       exit (0);
     }
   signal (SIGTERM, msgcatch);
   signal (SIGINT, msgcatch);
+  signal (SIGHUP, msgcatch);
   if (p > 0)
     {
       /* This is executed in the original process that did the fork above.  */
@@ -349,6 +356,10 @@
     {
       if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)
         {
+#ifdef EINTR
+	  if (errno == EINTR)
+	    continue;
+#endif
 	  perror ("msgrcv");
 	  exit (1);
         }