GUC option log_pid is not checked [Fwd: Bug#149675: Fix] - Mailing list pgsql-patches

From Oliver Elphick
Subject GUC option log_pid is not checked [Fwd: Bug#149675: Fix]
Date
Msg-id 1023816004.16699.962.camel@linda
Whole thread Raw
Responses Re: GUC option log_pid is not checked [Fwd: Bug#149675: Fix]
List pgsql-patches
The GUC option log_pid is not checked; LOG_PID is used by default,
contrary to the documentation.  This patch fixes it.

-----Forwarded Message-----

From: Ymir <ymir@wolfheart.ro>
To: 149675@bugs.debian.org
Subject: Bug#149675: Fix
Date: 11 Jun 2002 18:28:43 +0300

As I said, I have a fix for it, a simple patch that solves it. (I've tested
it and it works, I can't see how it can be buggy seeing how simple it is)

----


diff -ruN postgresql-7.2.1/src/backend/utils/error/elog.c postgresql-7.2.1-patched/src/backend/utils/error/elog.c
--- postgresql-7.2.1/src/backend/utils/error/elog.c    Mon Nov  5 19:46:30 2001
+++ postgresql-7.2.1-patched/src/backend/utils/error/elog.c    Mon Jun 10 13:58:02 2002
@@ -563,6 +563,7 @@
 {
     static bool openlog_done = false;
     static unsigned long seq = 0;
+    static int log_options = LOG_NDELAY;
     static int    syslog_fac = LOG_LOCAL0;

     int            len = strlen(line);
@@ -588,7 +589,16 @@
             syslog_fac = LOG_LOCAL6;
         if (strcasecmp(Syslog_facility, "LOCAL7") == 0)
             syslog_fac = LOG_LOCAL7;
-        openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
+/*
+ * We never checked for the Log_pid configure option when logging to syslog.
+ * The fix is pretty self-explaining, we just check for it, set the
+ * appropriate value for log_options, with, or without LOG_PID.
+ * <ymir@wolfheart.ro>
+ */
+
+        if (Log_pid)
+            log_options = LOG_PID | LOG_NDELAY;
+        openlog(Syslog_ident, log_options, syslog_fac);
         openlog_done = true;
     }


-----End of Forwarded Message-----
--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Then said Jesus, Father, forgive them; for they know
      not what they do..."         Luke 23:34

Attachment

pgsql-patches by date:

Previous
From: "Dave Page"
Date:
Subject: Re: [ODBC] UI Update (was: int8 becames string in BDE :-()
Next
From: Manfred Koizar
Date:
Subject: WriteBuffer return value