From b8a0f2d8ab1d7616d3d329049a396e464300479b Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 18 Oct 1994 11:23:18 +0000 Subject: [PATCH] [SYSV_IPC] (main): Catch SIGHUP as well. Don't call kill with pid 0. Handle EINTR when receiving messages. --- lib-src/emacsserver.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); } -- 2.39.5