patches/glibc/2.2.2/glibc-2.2.2-syslog-bugfix.patch
changeset 301 2be7232a73ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.2.2/glibc-2.2.2-syslog-bugfix.patch	Sat Jul 28 21:34:41 2007 +0000
     1.3 @@ -0,0 +1,60 @@
     1.4 +Backport a bugfix from glibc-2.2.5 to glibc-2.2.2 for the following problem:
     1.5 +  When syslog-ng is restarted (or HUPed), vixie-cron (and probably other
     1.6 +  programs) stop logging to syslog.
     1.7 +
     1.8 +
     1.9 +2001-08-27 Ulrich Drepper <Drepper@redhat.com> * misc/syslog.c (vsyslog):
    1.10 +  Try a bit harder to use syslogd.  If the connection went down after we
    1.11 +  first used it try to connect again and resend the message before printing
    1.12 +  to the console.
    1.13 +
    1.14 +http://sourceware.org/cgi-bin/cvsweb.cgi/libc/misc/Attic/syslog.c.diff?r1=1.32&r2=1.30&cvsroot=glibc
    1.15 +[ paths adjusted ]
    1.16 +
    1.17 +===================================================================
    1.18 +RCS file: /cvs/glibc/libc/misc/Attic/syslog.c,v
    1.19 +retrieving revision 1.30
    1.20 +retrieving revision 1.32
    1.21 +diff -u -r1.30 -r1.32
    1.22 +--- glibc-2.2.2/misc/syslog.c	2001/08/24 03:21:14	1.30
    1.23 ++++ glibc-2.2.5/misc/syslog.c	2001/08/30 23:13:49	1.32
    1.24 +@@ -239,17 +239,29 @@
    1.25 + 
    1.26 + 	if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
    1.27 + 	  {
    1.28 +-	    closelog_internal ();	/* attempt re-open next time */
    1.29 +-	    /*
    1.30 +-	     * Output the message to the console; don't worry about blocking,
    1.31 +-	     * if console blocks everything will.  Make sure the error reported
    1.32 +-	     * is the one from the syslogd failure.
    1.33 +-	     */
    1.34 +-	    if (LogStat & LOG_CONS &&
    1.35 +-		(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
    1.36 ++	    if (connected)
    1.37 + 	      {
    1.38 +-		dprintf (fd, "%s\r\n", buf + msgoff);
    1.39 +-		(void)__close(fd);
    1.40 ++		/* Try to reopen the syslog connection.  Maybe it went
    1.41 ++		   down.  */
    1.42 ++		closelog_internal ();
    1.43 ++		openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
    1.44 ++	      }
    1.45 ++
    1.46 ++	    if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
    1.47 ++	      {
    1.48 ++		closelog_internal ();	/* attempt re-open next time */
    1.49 ++		/*
    1.50 ++		 * Output the message to the console; don't worry
    1.51 ++		 * about blocking, if console blocks everything will.
    1.52 ++		 * Make sure the error reported is the one from the
    1.53 ++		 * syslogd failure.
    1.54 ++		 */
    1.55 ++		if (LogStat & LOG_CONS &&
    1.56 ++		    (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
    1.57 ++		  {
    1.58 ++		    dprintf (fd, "%s\r\n", buf + msgoff);
    1.59 ++		    (void)__close(fd);
    1.60 ++		  }
    1.61 + 	      }
    1.62 + 	  }
    1.63 +