From 9e3891de7c3886dce11f9d13b7aad2b6ee1eb48b Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 8 Feb 1994 23:57:30 +0000 Subject: [PATCH] (main) [HAVE_SYSVIPC]: Reverse test of fork value. --- lib-src/emacsserver.c | 7 +++++-- 1 file 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) -- 2.39.5