summaryrefslogtreecommitdiffstats
path: root/plugins/imklog/linux.c
diff options
context:
space:
mode:
authorMichael Terry <mike@bongo.(none)>2009-06-18 13:51:17 -0400
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-29 10:58:38 +0200
commitba4806a70439dd24dc98bd707893b1319dd5e3ef (patch)
tree0d899a388b125f2dd6f5442809e40830c56ed8b9 /plugins/imklog/linux.c
parent279896ebda98804c89899c53f857ca189ab24f45 (diff)
downloadrsyslog-ba4806a70439dd24dc98bd707893b1319dd5e3ef.tar.gz
rsyslog-ba4806a70439dd24dc98bd707893b1319dd5e3ef.tar.bz2
rsyslog-ba4806a70439dd24dc98bd707893b1319dd5e3ef.zip
add support for KLogPath
Diffstat (limited to 'plugins/imklog/linux.c')
-rw-r--r--plugins/imklog/linux.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/imklog/linux.c b/plugins/imklog/linux.c
index 0dd4320d..fcd9d6cd 100644
--- a/plugins/imklog/linux.c
+++ b/plugins/imklog/linux.c
@@ -84,6 +84,11 @@ static enum LOGSRC {none, proc, kernel} logsrc;
extern int ksyslog(int type, char *buf, int len);
+static uchar *GetPath(void)
+{
+ return pszPath ? pszPath : _PATH_KLOG;
+}
+
static void CloseLogSrc(void)
{
/* Turn on logging of messages to console, but only if we had the -c
@@ -135,7 +140,7 @@ static enum LOGSRC GetKernelLogSrc(void)
* file system is available to get kernel messages from.
*/
if ( use_syscall ||
- ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT)) )
+ ((stat(GetPath(), &sb) < 0) && (errno == ENOENT)) )
{
/* Initialize kernel logging. */
ksyslog(1, NULL, 0);
@@ -144,14 +149,14 @@ static enum LOGSRC GetKernelLogSrc(void)
return(kernel);
}
- if ( (kmsg = open(_PATH_KLOG, O_RDONLY|O_CLOEXEC)) < 0 )
+ if ( (kmsg = open(GetPath(), O_RDONLY|O_CLOEXEC)) < 0 )
{
imklogLogIntMsg(LOG_ERR, "imklog: Cannot open proc file system, %d.\n", errno);
ksyslog(7, NULL, 0); /* TODO: check this, implement more */
return(none);
}
- imklogLogIntMsg(LOG_INFO, "imklog %s, log source = %s started.", VERSION, _PATH_KLOG);
+ imklogLogIntMsg(LOG_INFO, "imklog %s, log source = %s started.", VERSION, GetPath());
return(proc);
}