Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2002 17:37:13 +0000
From:      David Malone <dwmalone@maths.tcd.ie>
To:        audit@freebsd.org
Cc:        Chris Johnson <cjohnson@palomine.net>, Brian McDonald <brian@lustygrapes.net>
Subject:   Syslog hangong on console.
Message-ID:   <200202171737.aa59770@salmon.maths.tcd.ie>

next in thread | raw e-mail | index | archive | help
There have been several complaints over the years of syslogd getting
stuck and then processes hanging as they try to syslog to the
console.

I haven't been able to reproduce syslogd hanging, but the following
patch makes the problem less critical by avoiding the hang if someone
calls syslog(3) and it can't talk to syslogd. This means that you
can at least su and try to sort out the problem.

Can anyone see any problems with this patch? (The comment dates from
the CSRG days, when the console hanging would have been somewhat more
serious than now, when some bloke at the co-lo might just have tipped
scroll-lock...)

	David.

Index: syslog.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/lib/libc/gen/syslog.c,v
retrieving revision 1.24
diff -u -r1.24 syslog.c
--- syslog.c	1 Feb 2002 01:32:19 -0000	1.24
+++ syslog.c	8 Feb 2002 21:05:17 -0000
@@ -255,12 +255,12 @@
 		return;
 
 	/*
-	 * Output the message to the console; don't worry about blocking,
-	 * if console blocks everything will.  Make sure the error reported
-	 * is the one from the syslogd failure.
+	 * Output the message to the console; try not to block
+	 * as a blocking console should not stop other processes.
+	 * Make sure the error reported is the one from the syslogd failure.
 	 */
 	if (LogStat & LOG_CONS &&
-	    (fd = _open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
+	    (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) {
 		struct iovec iov[2];
 		struct iovec *v = iov;
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200202171737.aa59770>