# HG changeset patch # User Richard M. Stallman # Date 760751850 0 # Node ID 16e98db8cc1b4df3c8971f6a53857989bf7953a5 # Parent c23afcf4e954050c5b148620d19d2f07a6ad3988 (main) [HAVE_SYSVIPC]: Reverse test of fork value. diff -r c23afcf4e954 -r 16e98db8cc1b lib-src/emacsserver.c --- a/lib-src/emacsserver.c Tue Feb 08 23:50:09 1994 +0000 +++ b/lib-src/emacsserver.c Tue Feb 08 23:57:30 1994 +0000 @@ -282,13 +282,15 @@ } 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 @@ } } + /* This is executed in the child made by forking above. */ while (1) { if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)