diff options
author | Rainer Gerhards <rgerhards@hq.adiscon.com> | 2008-11-24 17:48:12 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@hq.adiscon.com> | 2008-11-24 17:48:12 +0100 |
commit | 2275a915e02ca4fd1cd1b3c450b0089ae98bc907 (patch) | |
tree | 373c2f25ad21c75619714e93d6b84d8f74b44a30 /plugins | |
parent | c2fef48bd32ac6fcd6c8664976a39424187f4872 (diff) | |
download | rsyslog-2275a915e02ca4fd1cd1b3c450b0089ae98bc907.tar.gz rsyslog-2275a915e02ca4fd1cd1b3c450b0089ae98bc907.tar.xz rsyslog-2275a915e02ca4fd1cd1b3c450b0089ae98bc907.zip |
bugfix: imklog did not compile on freeBSD
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/imklog/bsd.c | 6 | ||||
-rw-r--r-- | plugins/imklog/imklog.c | 11 | ||||
-rw-r--r-- | plugins/imklog/imklog.h | 1 |
3 files changed, 15 insertions, 3 deletions
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); |