patches/glibc/2.2.2/glibc-2.2.2-syslog-bugfix.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 Backport a bugfix from glibc-2.2.5 to glibc-2.2.2 for the following problem:
     2   When syslog-ng is restarted (or HUPed), vixie-cron (and probably other
     3   programs) stop logging to syslog.
     4 
     5 
     6 2001-08-27 Ulrich Drepper <Drepper@redhat.com> * misc/syslog.c (vsyslog):
     7   Try a bit harder to use syslogd.  If the connection went down after we
     8   first used it try to connect again and resend the message before printing
     9   to the console.
    10 
    11 http://sourceware.org/cgi-bin/cvsweb.cgi/libc/misc/Attic/syslog.c.diff?r1=1.32&r2=1.30&cvsroot=glibc
    12 [ paths adjusted ]
    13 
    14 ===================================================================
    15 RCS file: /cvs/glibc/libc/misc/Attic/syslog.c,v
    16 retrieving revision 1.30
    17 retrieving revision 1.32
    18 diff -u -r1.30 -r1.32
    19 --- glibc-2.2.2/misc/syslog.c	2001/08/24 03:21:14	1.30
    20 +++ glibc-2.2.5/misc/syslog.c	2001/08/30 23:13:49	1.32
    21 @@ -239,17 +239,29 @@
    22  
    23  	if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
    24  	  {
    25 -	    closelog_internal ();	/* attempt re-open next time */
    26 -	    /*
    27 -	     * Output the message to the console; don't worry about blocking,
    28 -	     * if console blocks everything will.  Make sure the error reported
    29 -	     * is the one from the syslogd failure.
    30 -	     */
    31 -	    if (LogStat & LOG_CONS &&
    32 -		(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
    33 +	    if (connected)
    34  	      {
    35 -		dprintf (fd, "%s\r\n", buf + msgoff);
    36 -		(void)__close(fd);
    37 +		/* Try to reopen the syslog connection.  Maybe it went
    38 +		   down.  */
    39 +		closelog_internal ();
    40 +		openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
    41 +	      }
    42 +
    43 +	    if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
    44 +	      {
    45 +		closelog_internal ();	/* attempt re-open next time */
    46 +		/*
    47 +		 * Output the message to the console; don't worry
    48 +		 * about blocking, if console blocks everything will.
    49 +		 * Make sure the error reported is the one from the
    50 +		 * syslogd failure.
    51 +		 */
    52 +		if (LogStat & LOG_CONS &&
    53 +		    (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
    54 +		  {
    55 +		    dprintf (fd, "%s\r\n", buf + msgoff);
    56 +		    (void)__close(fd);
    57 +		  }
    58  	      }
    59  	  }
    60