X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.c;h=99f48caffa5ca9e25405fa05bf3332ef31763bea;hb=df135922b19890047ebf725e6b82cd1c174c6d52;hp=76c7036da0007c41a215b9e148a5e512e1e663d2;hpb=553925e1da5c936de4df809f0b4b80f527a7caf1;p=collectd.git diff --git a/src/daemon/common.c b/src/daemon/common.c index 76c7036d..99f48caf 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -27,10 +27,6 @@ * Michał Mirosław **/ -#if HAVE_CONFIG_H -#include "config.h" -#endif - #include "collectd.h" #include "common.h" @@ -68,12 +64,17 @@ extern kstat_ctl_t *kc; #endif +#if !defined(MSG_DONTWAIT) +#if defined(MSG_NONBLOCK) /* AIX doesn't have MSG_DONTWAIT */ -#ifndef MSG_DONTWAIT #define MSG_DONTWAIT MSG_NONBLOCK -#endif +#else +/* Windows doesn't have MSG_DONTWAIT or MSG_NONBLOCK */ +#define MSG_DONTWAIT 0 +#endif /* defined(MSG_NONBLOCK) */ +#endif /* !defined(MSG_DONTWAIT) */ -#if !HAVE_GETPWNAM_R +#if !HAVE_GETPWNAM_R && defined(HAVE_GETPWNAM) static pthread_mutex_t getpwnam_r_lock = PTHREAD_MUTEX_INITIALIZER; #endif @@ -1132,6 +1133,9 @@ int parse_value_file(char const *path, value_t *ret_value, int ds_type) { #if !HAVE_GETPWNAM_R int getpwnam_r(const char *name, struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp) { +#ifndef HAVE_GETPWNAM + return -1; +#else int status = 0; struct passwd *pw; @@ -1174,6 +1178,7 @@ int getpwnam_r(const char *name, struct passwd *pwbuf, char *buf, size_t buflen, pthread_mutex_unlock(&getpwnam_r_lock); return status; +#endif /* HAVE_GETPWNAM */ } /* int getpwnam_r */ #endif /* !HAVE_GETPWNAM_R */