* Michał Mirosław <mirq-linux at rere.qmqm.pl>
**/
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "collectd.h"
#include "common.h"
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
/* Move everything after the position one position to the left.
* Add a null-byte as last character in the buffer. */
memmove(buf + i + 1, buf + i + 2, buf_len - i - 2);
- buf[buf_len - 1] = 0;
+ buf[buf_len - 1] = '\0';
}
return 0;
} /* int strunescape */
value_len = strlen(value);
while ((value_len > 0) && isspace((int)value[value_len - 1])) {
- value[value_len - 1] = 0;
+ value[value_len - 1] = '\0';
value_len--;
}
#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;
pthread_mutex_unlock(&getpwnam_r_lock);
return status;
+#endif /* HAVE_GETPWNAM */
} /* int getpwnam_r */
#endif /* !HAVE_GETPWNAM_R */