Fix kill() call in elog() so that it gets its own pid by calling getpid().
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 16 Apr 1999 06:38:17 +0000 (06:38 +0000)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 16 Apr 1999 06:38:17 +0000 (06:38 +0000)
MyProcPid global variable is set to 0 when postgres starts as a command
(not as a backend daemon). This leads issuing SIGQUIT to the process group,
not the process itself. As a result, parent sh gets core dumped in the
Wisconsin benchmark test.

src/backend/utils/error/elog.c

index 2bb0675b616a0b8bbd02f413400f1889cdb564f6..bac42f9672b0222ab76a2616ad2775d332e35f7c 100644 (file)
@@ -221,7 +221,11 @@ elog(int lev, const char *fmt,...)
                ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
                if (!InError)
                {
-                       kill(MyProcPid, SIGQUIT);       /* abort to traffic cop */
+                       if (MyProcPid == 0) {
+                               kill(getpid(), SIGQUIT);
+                       } else {
+                               kill(MyProcPid, SIGQUIT);       /* abort to traffic cop */
+                       }
                        pause();
                }