bugfix imkmsg: infinite loop on OpenVZ VMs

This commit is contained in:
Paul Donohue 2014-10-15 18:19:05 -04:00 committed by Rainer Gerhards
parent 084952b796
commit ab577745bb
2 changed files with 12 additions and 1 deletions

View File

@ -158,6 +158,7 @@ submitSyslog(uchar *buf)
rsRetVal
klogWillRun(modConfData_t *pModConf)
{
int i;
char errmsg[2048];
DEFiRet;
@ -168,6 +169,16 @@ klogWillRun(modConfData_t *pModConf)
ABORT_FINALIZE(RS_RET_ERR_OPEN_KLOG);
}
/* make sure the kernel log is readable */
/* this normally returns EINVAL - on an OpenVZ VM, we get EBADF */
i = read(fklog, NULL, 0);
if (i < 0 && errno == EBADF) {
imkmsgLogIntMsg(RS_RET_ERR_OPEN_KLOG, "imkmsg: cannot read kernel log(%s): %s.",
_PATH_KLOG, rs_strerror_r(errno, errmsg, sizeof(errmsg)));
fklog = -1;
ABORT_FINALIZE(RS_RET_ERR_OPEN_KLOG);
}
finalize_it:
RETiRet;
}

View File

@ -315,7 +315,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_VAR_NOT_FOUND = -2142, /**< variable not found */
RS_RET_EMPTY_MSG = -2143, /**< provided (raw) MSG is empty */
RS_RET_PEER_CLOSED_CONN = -2144, /**< remote peer closed connection (information, no error) */
RS_RET_ERR_OPEN_KLOG = -2145, /**< error opening the kernel log socket (primarily solaris) */
RS_RET_ERR_OPEN_KLOG = -2145, /**< error opening or reading the kernel log socket */
RS_RET_ERR_AQ_CONLOG = -2146, /**< error aquiring console log (on solaris) */
RS_RET_ERR_DOOR = -2147, /**< some problems with handling the Solaris door functionality */
RS_RET_NO_SRCNAME_TPL = -2150, /**< sourcename template was not specified where one was needed (omudpspoof spoof addr) */