diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-12-03 13:53:05 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-12-03 13:53:05 +0000 |
commit | 1c3baa7191e5598c9ea082ba2f1d827559909e67 (patch) | |
tree | fda07497530c89737a6f5beb836fd8845b7d4029 | |
parent | 2b5e4d68ed1e45b3732e53ee382161c8150dddce (diff) | |
download | rsyslog-1c3baa7191e5598c9ea082ba2f1d827559909e67.tar.gz rsyslog-1c3baa7191e5598c9ea082ba2f1d827559909e67.tar.xz rsyslog-1c3baa7191e5598c9ea082ba2f1d827559909e67.zip |
added Bartosz Kuzma patches for better compatibility with NetBSD - many
thanks for them!
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | msg.c | 2 | ||||
-rw-r--r-- | omusrmsg.c | 3 | ||||
-rw-r--r-- | parse.c | 12 | ||||
-rw-r--r-- | pidfile.c | 10 | ||||
-rwxr-xr-x | srUtils.c | 2 | ||||
-rw-r--r-- | syslogd.c | 34 |
8 files changed, 57 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am index c49deeeb..d4cf4bd8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,7 +63,10 @@ rsyslogd_SOURCES = \ gss-misc.h rsyslogd_CPPFLAGS = -D_PATH_MODDIR=\"$(pkglibdir)/\" $(pthreads_cflags) -rsyslogd_LDADD = $(zlib_libs) $(pthreads_libs) $(gss_libs) -ldl +rsyslogd_LDADD = $(zlib_libs) $(pthreads_libs) $(gss_libs) +if HAVE_LIBDL +rsyslogd_LDADD += -ldl +endif rsyslogd_LDFLAGS = -export-dynamic man_MANS = rfc3195d.8 rklogd.8 rsyslogd.8 rsyslog.conf.5 diff --git a/configure.ac b/configure.ac index b4892f68..12d7d3f9 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,8 @@ esac # Checks for libraries. AC_CHECK_LIB(rt,clock_gettime,,,) -AC_CHECK_LIB(dl,dlopen,,,) +AC_CHECK_LIB(dl,dlopen,[have_libdl = yes],[have_libdl = no],) +AM_CONDITIONAL(HAVE_LIBDL, test x$have_libdl = xyes) # Checks for header files. AC_HEADER_RESOLV @@ -340,14 +341,14 @@ AC_OUTPUT echo "****************************************************" echo "rsyslog will be compiled with the following settings:" echo -echo "Multithreading support enabled: $enable_pthreads" -echo "Klogd functionality enabled: $enable_klogd" -echo "Regular expressions support enabled: $enable_regexp" +echo "Multithreading support enabled: $enable_pthreads" +echo "Klogd functionality enabled: $enable_klogd" +echo "Regular expressions support enabled: $enable_regexp" echo "Zlib compression support enabled: $enable_zlib" -echo "MySql support enabled: $enable_mysql" +echo "MySql support enabled: $enable_mysql" echo "PostgreSQL support enabled: $enable_pgsql" -echo "Large file support enabled: $enable_largefile" -echo "Networking support enabled: $enable_inet" +echo "Large file support enabled: $enable_largefile" +echo "Networking support enabled: $enable_inet" echo "Enable GSSAPI Kerberos 5 support: $want_gssapi_krb5" -echo "Debug mode enabled: $enable_debug" +echo "Debug mode enabled: $enable_debug" @@ -1605,7 +1605,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, pSrc = pRes; while(*pSrc) { *pB++ = (pTpe->data.field.eCaseConv == tplCaseConvUpper) ? - toupper(*pSrc) : tolower(*pSrc); + (char)toupper((int)*pSrc) : (char)tolower((int)*pSrc); /* currently only these two exist */ ++pSrc; } @@ -48,6 +48,9 @@ #else #include <sys/msgbuf.h> #endif +#if HAVE_PATHS_H +#include <paths.h> +#endif #include "srUtils.h" #include "stringbuf.h" #include "syslogd-types.h" @@ -414,7 +414,11 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_family = AF_INET6; - hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; +# ifdef AI_ADDRCONFIG + hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; +# else + hints.ai_flags = AI_NUMERICHOST; +# endif switch(getaddrinfo ((char*)pszIP+1, NULL, &hints, &res)) { case 0: @@ -449,7 +453,11 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) } else { /* now parse IPv4 */ memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_family = AF_INET; - hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; +# ifdef AI_ADDRCONFIG + hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; +# else + hints.ai_flags = AI_NUMERICHOST; +# endif switch(getaddrinfo ((char*)pszIP, NULL, &hints, &res)) { case 0: @@ -119,8 +119,9 @@ int write_pid (char *pidfile) pid = getpid(); if (!fprintf(f,"%d\n", pid)) { - char errStr[1024]; - printf("Can't write pid , %s.\n", strerror_r(errno, errStr, sizeof(errStr))); + char errStr[1024]; + strerror_r(errno, errStr, sizeof(errStr)); + printf("Can't write pid , %s.\n", errStr); close(fd); return 0; } @@ -128,8 +129,9 @@ int write_pid (char *pidfile) #ifndef __sun if (flock(fd, LOCK_UN) == -1) { - char errStr[1024]; - printf("Can't unlock pidfile %s, %s.\n", pidfile, strerror_r(errno, errStr, sizeof(errStr))); + char errStr[1024]; + strerror_r(errno, errStr, sizeof(errStr)); + printf("Can't unlock pidfile %s, %s.\n", pidfile, errStr); close(fd); return 0; } @@ -36,7 +36,7 @@ #include <sys/types.h> #include <signal.h> #include <assert.h> -#include <wait.h> +#include <sys/wait.h> #include <ctype.h> #include "liblogging-stub.h" /* THIS IS A MODIFICATION FOR RSYSLOG! 2004-11-18 rgerards */ #define TRUE 1 @@ -146,6 +146,7 @@ #include <stdio.h> #include <stddef.h> #include <ctype.h> +#include <limits.h> #define GNU_SOURCE #include <string.h> #include <stdarg.h> @@ -165,9 +166,11 @@ #include <sys/file.h> #include <sys/un.h> #include <sys/time.h> -#ifdef BSD + +#if HAVE_SYS_TIMESPEC_H # include <sys/timespec.h> #endif + #include <sys/resource.h> #include <signal.h> @@ -829,8 +832,10 @@ static rsRetVal AddAllowedSender(struct AllowedSenders **ppRoot, struct AllowedS memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_ADDRCONFIG; hints.ai_socktype = SOCK_DGRAM; +# ifdef AI_ADDRCONFIG /* seems not to be present on all systems */ + hints.ai_flags = AI_ADDRCONFIG; +# endif if (getaddrinfo (iAllow->addr.HostWildcard, NULL, &hints, &res) != 0) { logerrorSz("DNS error: Can't resolve \"%s\", not added as allowed sender", iAllow->addr.HostWildcard); @@ -3523,8 +3528,10 @@ void logerror(char *type) if (errno == 0) snprintf(buf, sizeof(buf), "%s", type); - else - snprintf(buf, sizeof(buf), "%s: %s", type, strerror_r(errno, errStr, sizeof(errStr))); + else { + strerror_r(errno, errStr, sizeof(errStr)); + snprintf(buf, sizeof(buf), "%s: %s", type, errStr); + } buf[sizeof(buf)/sizeof(char) - 1] = '\0'; /* just to be on the safe side... */ errno = 0; logmsgInternal(LOG_SYSLOG|LOG_ERR, buf, ADDDATE); @@ -3767,7 +3774,9 @@ static rsRetVal doIncludeDirectory(uchar *pDirName) continue; /* these files we are also not interested in */ ++iEntriesDone; /* construct filename */ - iFileNameLen = strnlen(res->d_name, NAME_MAX); + iFileNameLen = strlen(res->d_name); + if (iFileNameLen > NAME_MAX) + iFileNameLen = NAME_MAX; memcpy(szFullFileName + iDirNameLen, res->d_name, iFileNameLen); *(szFullFileName + iDirNameLen + iFileNameLen) = '\0'; dbgprintf("including file '%s'\n", szFullFileName); @@ -4260,8 +4269,10 @@ finalize_it: char errStr[1024]; if(fCurr != NULL) selectorDestruct(fCurr); + + strerror_r(errno, errStr, sizeof(errStr)); dbgprintf("error %d processing config file '%s'; os error (if any): %s\n", - iRet, pConfFile, strerror_r(errno, errStr, sizeof(errStr))); + iRet, pConfFile, errStr); } return iRet; } @@ -4377,7 +4388,7 @@ static void init(void) * We ignore any errors while doing this - we would be lost anyhow... */ selector_t *f = NULL; - char szTTYNameBuf[TTY_NAME_MAX+1]; /* +1 for NULL character */ + char szTTYNameBuf[_POSIX_TTY_NAME_MAX+1]; /* +1 for NULL character */ dbgprintf("primary config file could not be opened - using emergency definitions.\n"); cfline((uchar*)"*.ERR\t" _PATH_CONSOLE, &f); cfline((uchar*)"*.PANIC\t*", &f); @@ -5627,8 +5638,9 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se printchopped(LocalHostName, line, iRcvd, fd, funixParseHost[i]); } else if (iRcvd < 0 && errno != EINTR) { char errStr[1024]; + strerror_r(errno, errStr, sizeof(errStr)); dbgprintf("UNIX socket error: %d = %s.\n", \ - errno, strerror_r(errno, errStr, sizeof(errStr))); + errno, errStr); logerror("recvfrom UNIX"); } FDPROCESSED(); @@ -5666,8 +5678,8 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se } } else if (l < 0 && errno != EINTR && errno != EAGAIN) { char errStr[1024]; - dbgprintf("INET socket error: %d = %s.\n", - errno, strerror_r(errno, errStr, sizeof(errStr))); + strerror_r(errno, errStr, sizeof(errStr)); + dbgprintf("INET socket error: %d = %s.\n", errno, errStr); logerror("recvfrom inet"); /* should be harmless */ sleep(1); @@ -6392,7 +6404,7 @@ int main(int argc, char **argv) */ for (p = (char *)LocalDomain; *p ; p++) if (isupper((int) *p)) - *p = tolower(*p); + *p = (char)tolower((int)*p); memset(&sigAct, 0, sizeof (sigAct)); sigemptyset(&sigAct.sa_mask); |