diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2002-03-09 11:38:01 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2002-03-09 11:38:01 +0000 |
commit | 0379e0b3d77da01656c8f0697d8fd0f26737ced6 (patch) | |
tree | c8adb6bff42d2f6dfb0136c69fa584c42466875d | |
parent | 92d4835f65009bd14c876762cacfe790bd3ec913 (diff) | |
download | FreeBSD-src-0379e0b3d77da01656c8f0697d8fd0f26737ced6.zip FreeBSD-src-0379e0b3d77da01656c8f0697d8fd0f26737ced6.tar.gz |
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
-rw-r--r-- | lib/libc/gen/syslog.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 90fd904..11ae5b5 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; |