mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-17 10:30:43 +01:00
Fixes #4395 by correctly checking for EPIPE.
kmsg is a unique device, which can recover from EPIPE errors. The original code checked for this, but checked the return value for the libc read call, which always returns -1 and sets the appropriate errno. This meant that when an EPIPE error actually happened, the fd was infinitely retried. The 'for loop' was broken out of, but the readikmsg() function is repeatedly called. Note: there is an additional bug here. The readikmsg function needs better error checking on the fd. I suspect that this was rarely an issue because /dev/kmsg goes truly invalid when the system is actually shutting down. The fix here is to check the return value as well as the errno.
This commit is contained in:
parent
dbcef8a0d2
commit
feb6420148
@ -214,7 +214,7 @@ readkmsg(void)
|
||||
if (i > 0) {
|
||||
/* successful read of message of nonzero length */
|
||||
pRcv[i] = '\0';
|
||||
} else if (i == -EPIPE) {
|
||||
} else if (i < 0 && errno == EPIPE) {
|
||||
imkmsgLogIntMsg(LOG_WARNING,
|
||||
"imkmsg: some messages in circular buffer got overwritten");
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user