yann@1
|
1 |
Backport a bugfix from glibc-2.2.5 to glibc-2.2.2 for the following problem:
|
yann@1
|
2 |
When syslog-ng is restarted (or HUPed), vixie-cron (and probably other
|
yann@1
|
3 |
programs) stop logging to syslog.
|
yann@1
|
4 |
|
yann@1
|
5 |
|
yann@1
|
6 |
2001-08-27 Ulrich Drepper <Drepper@redhat.com> * misc/syslog.c (vsyslog):
|
yann@1
|
7 |
Try a bit harder to use syslogd. If the connection went down after we
|
yann@1
|
8 |
first used it try to connect again and resend the message before printing
|
yann@1
|
9 |
to the console.
|
yann@1
|
10 |
|
yann@1
|
11 |
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/misc/Attic/syslog.c.diff?r1=1.32&r2=1.30&cvsroot=glibc
|
yann@1
|
12 |
[ paths adjusted ]
|
yann@1
|
13 |
|
yann@1
|
14 |
===================================================================
|
yann@1
|
15 |
RCS file: /cvs/glibc/libc/misc/Attic/syslog.c,v
|
yann@1
|
16 |
retrieving revision 1.30
|
yann@1
|
17 |
retrieving revision 1.32
|
yann@1
|
18 |
diff -u -r1.30 -r1.32
|
yann@1
|
19 |
--- glibc-2.2.2/misc/syslog.c 2001/08/24 03:21:14 1.30
|
yann@1
|
20 |
+++ glibc-2.2.5/misc/syslog.c 2001/08/30 23:13:49 1.32
|
yann@1
|
21 |
@@ -239,17 +239,29 @@
|
yann@1
|
22 |
|
yann@1
|
23 |
if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
|
yann@1
|
24 |
{
|
yann@1
|
25 |
- closelog_internal (); /* attempt re-open next time */
|
yann@1
|
26 |
- /*
|
yann@1
|
27 |
- * Output the message to the console; don't worry about blocking,
|
yann@1
|
28 |
- * if console blocks everything will. Make sure the error reported
|
yann@1
|
29 |
- * is the one from the syslogd failure.
|
yann@1
|
30 |
- */
|
yann@1
|
31 |
- if (LogStat & LOG_CONS &&
|
yann@1
|
32 |
- (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
|
yann@1
|
33 |
+ if (connected)
|
yann@1
|
34 |
{
|
yann@1
|
35 |
- dprintf (fd, "%s\r\n", buf + msgoff);
|
yann@1
|
36 |
- (void)__close(fd);
|
yann@1
|
37 |
+ /* Try to reopen the syslog connection. Maybe it went
|
yann@1
|
38 |
+ down. */
|
yann@1
|
39 |
+ closelog_internal ();
|
yann@1
|
40 |
+ openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
|
yann@1
|
41 |
+ }
|
yann@1
|
42 |
+
|
yann@1
|
43 |
+ if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
|
yann@1
|
44 |
+ {
|
yann@1
|
45 |
+ closelog_internal (); /* attempt re-open next time */
|
yann@1
|
46 |
+ /*
|
yann@1
|
47 |
+ * Output the message to the console; don't worry
|
yann@1
|
48 |
+ * about blocking, if console blocks everything will.
|
yann@1
|
49 |
+ * Make sure the error reported is the one from the
|
yann@1
|
50 |
+ * syslogd failure.
|
yann@1
|
51 |
+ */
|
yann@1
|
52 |
+ if (LogStat & LOG_CONS &&
|
yann@1
|
53 |
+ (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
|
yann@1
|
54 |
+ {
|
yann@1
|
55 |
+ dprintf (fd, "%s\r\n", buf + msgoff);
|
yann@1
|
56 |
+ (void)__close(fd);
|
yann@1
|
57 |
+ }
|
yann@1
|
58 |
}
|
yann@1
|
59 |
}
|
yann@1
|
60 |
|