summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-10-18 11:23:18 +0000
committerRichard M. Stallman <rms@gnu.org>1994-10-18 11:23:18 +0000
commitadf034dbc0824ead0d11085167f253a6504ed9b7 (patch)
treea341e3ced5a9601287feb63e69f97dfec1d16166 /lib-src
parentcb628676600672d115c0239156420954ec407559 (diff)
downloademacs-adf034dbc0824ead0d11085167f253a6504ed9b7.tar.gz
[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 ()
#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 @@ 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);
}