summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--plugins/imklog/bsd.c6
-rw-r--r--plugins/imklog/imklog.c11
-rw-r--r--plugins/imklog/imklog.h1
4 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f393cea1..a17ad653 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
---------------------------------------------------------------------------
+Version 3.21.8 [BETA] (rgerhards), 2008-11-??
+- bugfix: imklog did not compile on FreeBSD
+---------------------------------------------------------------------------
Version 3.21.7 [BETA] (rgerhards), 2008-11-11
- this is the new beta branch, based on the former 3.21.6 devel
- new functionality: ZERO property replacer nomatch option (from v3-stable)
diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c
index 0a581081..090c4e9b 100644
--- a/plugins/imklog/bsd.c
+++ b/plugins/imklog/bsd.c
@@ -116,7 +116,7 @@ readklog(void)
uchar bufRcv[4096+1];
uchar *pRcv = NULL; /* receive buffer */
- iMaxLine = glbl.GetMaxLine();
+ iMaxLine = klog_getMaxLine();
/* we optimize performance: if iMaxLine is below 4K (which it is in almost all
* cases, we use a fixed buffer on the stack. Only if it is higher, heap memory
@@ -127,7 +127,8 @@ readklog(void)
if((size_t) iMaxLine < sizeof(bufRcv) - 1) {
pRcv = bufRcv;
} else {
- CHKmalloc(pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1)));
+ if((pRcv = (uchar*) malloc(sizeof(uchar) * (iMaxLine + 1))) == NULL)
+ iMaxLine = sizeof(bufRcv) - 1; /* better this than noting */
}
len = 0;
@@ -161,7 +162,6 @@ readklog(void)
if (len > 0)
Syslog(LOG_INFO, pRcv);
-finalize_it:
if(pRcv != NULL && (size_t) iMaxLine >= sizeof(bufRcv) - 1)
free(pRcv);
}
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 84c32d11..20bc34ab 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -199,6 +199,17 @@ finalize_it:
}
+/* helper for some klog drivers which need to know the MaxLine global setting. They can
+ * not obtain it themselfs, because they are no modules and can not query the object hander.
+ * It would probably be a good idea to extend the interface to support it, but so far
+ * we create a (sufficiently valid) work-around. -- rgerhards, 2008-11-24
+ */
+int klog_getMaxLine(void)
+{
+ return glbl.GetMaxLine();
+}
+
+
BEGINrunInput
CODESTARTrunInput
/* this is an endless loop - it is terminated when the thread is
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index 0847140b..37bd58b0 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -58,6 +58,7 @@ rsRetVal imklogLogIntMsg(int priority, char *fmt, ...) __attribute__((format(pri
rsRetVal Syslog(int priority, uchar *msg);
/* prototypes */
+extern int klog_getMaxLine(void); /* work-around for klog drivers to get configured max line size */
extern int InitKsyms(char *);
extern void DeinitKsyms(void);
extern int InitMsyms(void);