From 24fd07ebe66c56430ca8a752ad1703d29c2f9da4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 6 Mar 2008 09:59:35 +0000 Subject: (tried to) fix logerror() call under BSD (but can not yet compile, so this may be an error...) --- errmsg.c | 2 +- net.c | 4 ++-- omusrmsg.c | 5 ++++- plugins/imfile/imfile.c | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/errmsg.c b/errmsg.c index 43593a75..907046b9 100644 --- a/errmsg.c +++ b/errmsg.c @@ -49,7 +49,7 @@ DEFobjStaticHelpers * to check errno and, if so, how to do that in a clean way. */ static void __attribute__((format(printf, 2, 3))) -LogError(int iErrCode, char *fmt, ... ) +LogError(int __attribute__((unused)) iErrCode, char *fmt, ... ) { va_list ap; char buf[1024]; diff --git a/net.c b/net.c index 43c30b53..103d975c 100644 --- a/net.c +++ b/net.c @@ -195,7 +195,7 @@ static rsRetVal AddAllowedSender(struct AllowedSenders **ppRoot, struct AllowedS switch (iAllow->addr.NetAddr->sa_family) { case AF_INET: if((iSignificantBits < 1) || (iSignificantBits > 32)) { - errmsg.LogError(NO_ERRCODE, "Invalid bit number in IPv4 address - adjusted to 32", + errmsg.LogError(NO_ERRCODE, "Invalid number of bits (%d) in IPv4 address - adjusted to 32", (int)iSignificantBits); iSignificantBits = 32; } @@ -204,7 +204,7 @@ static rsRetVal AddAllowedSender(struct AllowedSenders **ppRoot, struct AllowedS break; case AF_INET6: if((iSignificantBits < 1) || (iSignificantBits > 128)) { - errmsg.LogError(NO_ERRCODE, "Invalid bit number in IPv6 address - adjusted to 128", + errmsg.LogError(NO_ERRCODE, "Invalid number of bits (%d) in IPv6 address - adjusted to 128", iSignificantBits); iSignificantBits = 128; } diff --git a/omusrmsg.c b/omusrmsg.c index 382f6158..b8d212ac 100644 --- a/omusrmsg.c +++ b/omusrmsg.c @@ -58,6 +58,7 @@ #include "syslogd.h" #include "omusrmsg.h" #include "module-template.h" +#include "errmsg.h" /* portability: */ @@ -71,6 +72,7 @@ MODULE_TYPE_OUTPUT /* internal structures */ DEF_OMOD_STATIC_DATA +DEFobjCurrIf(errmsg) typedef struct _instanceData { int bIsWall; /* 1- is wall, 0 - individual users */ @@ -128,7 +130,7 @@ void setutent(void) { assert(BSD_uf == NULL); if ((BSD_uf = fopen(_PATH_UTMP, "r")) == NULL) { - logerror(_PATH_UTMP); + errmsg.LogError(NO_ERRNO, "%s", _PATH_UTMP); return; } } @@ -347,6 +349,7 @@ BEGINmodInit(UsrMsg) CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr + CHKiRet(objUse(errmsg, CORE_COMPONENT)); ENDmodInit /* diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 243004ab..c65fc436 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -32,6 +32,9 @@ #include #include #include /* do NOT remove: will soon be done by the module generation macros */ +#ifdef HAVE_SYS_STAT_H +# include +#endif #include "rsyslog.h" /* error codes etc... */ #include "syslogd.h" #include "cfsysline.h" /* access to config file objects */ -- cgit