summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-02-08 23:57:30 +0000
committerRichard M. Stallman <rms@gnu.org>1994-02-08 23:57:30 +0000
commitcd96532bb412abd26c9970bc343698e7788f00c8 (patch)
treecc129cdacf370ef6f25d6c94e5a2bf66b443d563 /lib-src
parent2085512de05020d513cb299f727e6a97e43fcee6 (diff)
downloademacs-cd96532bb412abd26c9970bc343698e7788f00c8.tar.gz
(main) [HAVE_SYSVIPC]: Reverse test of fork value.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsserver.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c
index 5e233148851..cf7a6dd78d5 100644
--- a/lib-src/emacsserver.c
+++ b/lib-src/emacsserver.c
@@ -282,13 +282,15 @@ main ()
}
signal (SIGTERM, msgcatch);
signal (SIGINT, msgcatch);
- /* If parent goes away, remove message box and exit */
- if (p == 0)
+ if (p > 0)
{
+ /* This is executed in the original process that did the fork above. */
+ /* Get pid of Emacs itself. */
p = getppid ();
setpgrp (); /* Gnu kills process group on exit */
while (1)
{
+ /* Is Emacs still alive? */
if (kill (p, 0) < 0)
{
msgctl (s, IPC_RMID, 0);
@@ -298,6 +300,7 @@ main ()
}
}
+ /* This is executed in the child made by forking above. */
while (1)
{
if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)