X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fclient.c;h=df6fd960006fb82a80e4ab625a82c3ef2e955bcd;hb=7c9d772c992647fcba64a96800c146eb9f1647f8;hp=c3cd414f202e9878d15a7768ea830c634e87b34f;hpb=1035fba8812893e50d00a871e3399cc1ece3b384;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index c3cd414f..df6fd960 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -24,10 +24,13 @@ * Florian octo Forster **/ -#if HAVE_CONFIG_H -#include "config.h" +#ifdef WIN32 +#include "gnulib_config.h" +#include #endif +#include "config.h" + #if !defined(__GNUC__) || !__GNUC__ #define __attribute__(x) /**/ #endif @@ -42,11 +45,14 @@ #include #include #include -#include #include -#include #include +#ifndef WIN32 +#include +#include +#endif + #include "collectd/client.h" /* NI_MAXHOST has been obsoleted by RFC 3493 which is a reason for SunOS 5.11 @@ -64,6 +70,10 @@ #endif #endif +#ifdef WIN32 +#define AI_ADDRCONFIG 0 +#endif + /* Secure/static macros. They work like `strcpy' and `strcat', but assure null * termination. They work for static buffers only, because they use `sizeof'. * The `SSTRCATF' combines the functionality of `snprintf' and `strcat' which @@ -92,7 +102,6 @@ #define LCC_SET_ERRSTR(c, ...) \ do { \ snprintf((c)->errbuf, sizeof((c)->errbuf), __VA_ARGS__); \ - (c)->errbuf[sizeof((c)->errbuf) - 1] = 0; \ } while (0) /* @@ -100,7 +109,7 @@ */ struct lcc_connection_s { FILE *fh; - char errbuf[1024]; + char errbuf[2048]; }; struct lcc_response_s { @@ -370,6 +379,10 @@ static int lcc_sendreceive(lcc_connection_t *c, /* {{{ */ static int lcc_open_unixsocket(lcc_connection_t *c, const char *path) /* {{{ */ { +#ifdef WIN32 + lcc_set_errno(c, ENOTSUP); + return -1; +#else struct sockaddr_un sa = {0}; int fd; int status; @@ -404,6 +417,7 @@ static int lcc_open_unixsocket(lcc_connection_t *c, const char *path) /* {{{ */ } return 0; +#endif /* WIN32 */ } /* }}} int lcc_open_unixsocket */ static int lcc_open_netsocket(lcc_connection_t *c, /* {{{ */