[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src/lookups pgsql.c
ph10 2006/07/14 15:42:57 BST

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src/lookups pgsql.c 
  Log:
  Add a call to PQsetNoticeProcessor() to catch PostgreSQL "notices" and
  thereby stop them being written to stderr (the default).


  Revision  Changes    Path
  1.378     +4 -0      exim/exim-doc/doc-txt/ChangeLog
  1.7       +28 -0     exim/exim-src/src/lookups/pgsql.c


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.377
  retrieving revision 1.378
  diff -u -r1.377 -r1.378
  --- ChangeLog    14 Jul 2006 14:32:08 -0000    1.377
  +++ ChangeLog    14 Jul 2006 14:42:57 -0000    1.378
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.377 2006/07/14 14:32:08 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.378 2006/07/14 14:42:57 ph10 Exp $


Change log file for Exim from version 4.21
-------------------------------------------
@@ -113,6 +113,10 @@

   PH/20 Perl can change the locale. Exim was resetting it after a ${perl call,
         but not after initializing Perl.
  +
  +PH/21 Added a call to PQsetNoticeProcessor() to catch pgsql "notices" and
  +      output them only if debugging. By default they are written stderr,
  +      apparently, which is not desirable.



Exim version 4.62

  Index: pgsql.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/lookups/pgsql.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- pgsql.c    14 Jul 2006 14:21:27 -0000    1.6
  +++ pgsql.c    14 Jul 2006 14:42:57 -0000    1.7
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/lookups/pgsql.c,v 1.6 2006/07/14 14:21:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/lookups/pgsql.c,v 1.7 2006/07/14 14:42:57 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -76,6 +76,28 @@
   }



  +/*************************************************
  +*       Notice processor function for pgsql      *
  +*************************************************/
  +
  +/* This function is passed to pgsql below, and called for any PostgreSQL
  +"notices". By default they are written to stderr, which is undesirable.
  +
  +Arguments:
  +  arg        an opaque user cookie (not used)
  +  message    the notice
  +
  +Returns:     nothing
  +*/
  +
  +static void
  +notice_processor(void *arg, const char *message)
  +{
  +arg = arg;   /* Keep compiler happy */
  +DEBUG(D_lookup) debug_printf("PGSQL: %s\n", message);
  +}
  +
  +


   /*************************************************
   *        Internal search function                *
  @@ -252,6 +274,12 @@
     or other multibyte code that might cause problems with escaping. */


     PQsetClientEncoding(pg_conn, "SQL_ASCII");
  +
  +  /* Set the notice processor to prevent notices from being written to stderr
  +  (which is what the default does). Our function (above) just produces debug
  +  output. */
  +
  +  PQsetNoticeProcessor(pg_conn, notice_processor, NULL);


     /* Add the connection to the cache */