yann@1: Backport a bugfix from glibc-2.2.5 to glibc-2.2.2 for the following problem: yann@1: When syslog-ng is restarted (or HUPed), vixie-cron (and probably other yann@1: programs) stop logging to syslog. yann@1: yann@1: yann@1: 2001-08-27 Ulrich Drepper * misc/syslog.c (vsyslog): yann@1: Try a bit harder to use syslogd. If the connection went down after we yann@1: first used it try to connect again and resend the message before printing yann@1: to the console. yann@1: yann@1: http://sourceware.org/cgi-bin/cvsweb.cgi/libc/misc/Attic/syslog.c.diff?r1=1.32&r2=1.30&cvsroot=glibc yann@1: [ paths adjusted ] yann@1: yann@1: =================================================================== yann@1: RCS file: /cvs/glibc/libc/misc/Attic/syslog.c,v yann@1: retrieving revision 1.30 yann@1: retrieving revision 1.32 yann@1: diff -u -r1.30 -r1.32 yann@1: --- glibc-2.2.2/misc/syslog.c 2001/08/24 03:21:14 1.30 yann@1: +++ glibc-2.2.5/misc/syslog.c 2001/08/30 23:13:49 1.32 yann@1: @@ -239,17 +239,29 @@ yann@1: yann@1: if (!connected || __send(LogFile, buf, bufsize, 0) < 0) yann@1: { yann@1: - closelog_internal (); /* attempt re-open next time */ yann@1: - /* yann@1: - * Output the message to the console; don't worry about blocking, yann@1: - * if console blocks everything will. Make sure the error reported yann@1: - * is the one from the syslogd failure. yann@1: - */ yann@1: - if (LogStat & LOG_CONS && yann@1: - (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0) yann@1: + if (connected) yann@1: { yann@1: - dprintf (fd, "%s\r\n", buf + msgoff); yann@1: - (void)__close(fd); yann@1: + /* Try to reopen the syslog connection. Maybe it went yann@1: + down. */ yann@1: + closelog_internal (); yann@1: + openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); yann@1: + } yann@1: + yann@1: + if (!connected || __send(LogFile, buf, bufsize, 0) < 0) yann@1: + { yann@1: + closelog_internal (); /* attempt re-open next time */ yann@1: + /* yann@1: + * Output the message to the console; don't worry yann@1: + * about blocking, if console blocks everything will. yann@1: + * Make sure the error reported is the one from the yann@1: + * syslogd failure. yann@1: + */ yann@1: + if (LogStat & LOG_CONS && yann@1: + (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0) yann@1: + { yann@1: + dprintf (fd, "%s\r\n", buf + msgoff); yann@1: + (void)__close(fd); yann@1: + } yann@1: } yann@1: } yann@1: