GUC option log_pid is not checked [Fwd: Bug#149675: Fix]

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: pgsql-patches(at)postgresql(dot)org
Subject: GUC option log_pid is not checked [Fwd: Bug#149675: Fix]
Date: 2002-06-11 17:20:03
Message-ID: 1023816004.16699.962.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wolfheart(dot)ro>
To: 149675(at)bugs(dot)debian(dot)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(at)wolfheart(dot)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(dot)Elphick(at)lfix(dot)co(dot)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

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-06-11 22:31:53 Re: SSL (combined patches 1-4)
Previous Message Jan Wieck 2002-06-11 13:40:34 Re: Superficial changes for Win32