From: Richard M. Stallman Date: Tue, 18 Oct 1994 11:23:18 +0000 (+0000) Subject: [SYSV_IPC] (main): Catch SIGHUP as well. Don't X-Git-Tag: emacs-19.34~6261 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b8a0f2d8ab1d7616d3d329049a396e464300479b;p=emacs.git [SYSV_IPC] (main): Catch SIGHUP as well. Don't call kill with pid 0. Handle EINTR when receiving messages. --- 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 () #include #include #include +#include + +#ifndef errno +extern int errno; +#endif jmp_buf msgenv; @@ -303,11 +308,13 @@ main () 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 @@ main () { if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0) { +#ifdef EINTR + if (errno == EINTR) + continue; +#endif perror ("msgrcv"); exit (1); }