aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-02-08 23:57:30 +0000
committerRichard M. Stallman1994-02-08 23:57:30 +0000
commit9e3891de7c3886dce11f9d13b7aad2b6ee1eb48b (patch)
tree129a4c36b81bd153eb9ef1e62fccc5e8bc9fed3e /lib-src
parent3fa26c50017933e3104e965999b5423c038a4e39 (diff)
downloademacs-9e3891de7c3886dce11f9d13b7aad2b6ee1eb48b.tar.gz
emacs-9e3891de7c3886dce11f9d13b7aad2b6ee1eb48b.zip
(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 ()
282 } 282 }
283 signal (SIGTERM, msgcatch); 283 signal (SIGTERM, msgcatch);
284 signal (SIGINT, msgcatch); 284 signal (SIGINT, msgcatch);
285 /* If parent goes away, remove message box and exit */ 285 if (p > 0)
286 if (p == 0)
287 { 286 {
287 /* This is executed in the original process that did the fork above. */
288 /* Get pid of Emacs itself. */
288 p = getppid (); 289 p = getppid ();
289 setpgrp (); /* Gnu kills process group on exit */ 290 setpgrp (); /* Gnu kills process group on exit */
290 while (1) 291 while (1)
291 { 292 {
293 /* Is Emacs still alive? */
292 if (kill (p, 0) < 0) 294 if (kill (p, 0) < 0)
293 { 295 {
294 msgctl (s, IPC_RMID, 0); 296 msgctl (s, IPC_RMID, 0);
@@ -298,6 +300,7 @@ main ()
298 } 300 }
299 } 301 }
300 302
303 /* This is executed in the child made by forking above. */
301 while (1) 304 while (1)
302 { 305 {
303 if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0) 306 if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)