From 94998878b71fe0a0f28b2a34d2086bcd45d86167 Mon Sep 17 00:00:00 2001 From: David Malone Date: Sat, 9 Mar 2002 11:38:01 +0000 Subject: [PATCH] If syslog fails to talk to syslogd, then it tries to write a message to the console in a final attempt to log something. Make this final attempt non-blocking so that a blocking console doesn't end up blocking process which attempt to syslog something. In particular, this means you should be able to su and fix the problem if the console becomes blocking. MFC after: 3 weeks --- lib/libc/gen/syslog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 90fd9042cc0..11ae5b56fe8 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -255,12 +255,12 @@ vsyslog(pri, fmt, ap) 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;