aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-18 11:23:18 +0000
committerRichard M. Stallman1994-10-18 11:23:18 +0000
commitb8a0f2d8ab1d7616d3d329049a396e464300479b (patch)
tree9e31d1d387b65ccc4da47869b18cfb2cb9b9f488 /lib-src
parentc9c3d8f6484e136c574c78ccfff27c3775e239d8 (diff)
downloademacs-b8a0f2d8ab1d7616d3d329049a396e464300479b.tar.gz
emacs-b8a0f2d8ab1d7616d3d329049a396e464300479b.zip
[SYSV_IPC] (main): Catch SIGHUP as well. Don't
call kill with pid 0. Handle EINTR when receiving messages.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsserver.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c
index 1c8fc1d15ba..1017639bda2 100644
--- a/lib-src/emacsserver.c
+++ b/lib-src/emacsserver.c
@@ -252,6 +252,11 @@ main ()
252#include <sys/ipc.h> 252#include <sys/ipc.h>
253#include <sys/msg.h> 253#include <sys/msg.h>
254#include <setjmp.h> 254#include <setjmp.h>
255#include <errno.h>
256
257#ifndef errno
258extern int errno;
259#endif
255 260
256jmp_buf msgenv; 261jmp_buf msgenv;
257 262
@@ -303,11 +308,13 @@ main ()
303 if (setjmp (msgenv)) 308 if (setjmp (msgenv))
304 { 309 {
305 msgctl (s, IPC_RMID, 0); 310 msgctl (s, IPC_RMID, 0);
306 kill (p, SIGKILL); 311 if (p > 0)
312 kill (p, SIGKILL);
307 exit (0); 313 exit (0);
308 } 314 }
309 signal (SIGTERM, msgcatch); 315 signal (SIGTERM, msgcatch);
310 signal (SIGINT, msgcatch); 316 signal (SIGINT, msgcatch);
317 signal (SIGHUP, msgcatch);
311 if (p > 0) 318 if (p > 0)
312 { 319 {
313 /* This is executed in the original process that did the fork above. */ 320 /* This is executed in the original process that did the fork above. */
@@ -349,6 +356,10 @@ main ()
349 { 356 {
350 if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0) 357 if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)
351 { 358 {
359#ifdef EINTR
360 if (errno == EINTR)
361 continue;
362#endif
352 perror ("msgrcv"); 363 perror ("msgrcv");
353 exit (1); 364 exit (1);
354 } 365 }