diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-11-14 23:49:51 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-11-14 23:49:51 +0000 |
commit | 39356eb034b824da6aa83bb144df969115a8a163 (patch) | |
tree | 5ae3d2e6cd1cc127ecd64a0996b5c878e1199705 /infrastructure | |
parent | 881cd4e965012d7486b40af1f14014fd6069e4b9 (diff) |
Don't use getpeername(), sys/socket.h or sys/un.h on platforms that don't
include them, to fix compile on Windows.
Diffstat (limited to 'infrastructure')
-rw-r--r-- | infrastructure/buildenv-testmain-template.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/infrastructure/buildenv-testmain-template.cpp b/infrastructure/buildenv-testmain-template.cpp index 488e8623..0de18255 100644 --- a/infrastructure/buildenv-testmain-template.cpp +++ b/infrastructure/buildenv-testmain-template.cpp @@ -29,10 +29,16 @@ #include <getopt.h> #endif -#include <sys/socket.h> +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif + #include <sys/stat.h> #include <sys/types.h> -#include <sys/un.h> + +#ifdef HAVE_SYS_UN_H +# include <sys/un.h> +#endif #include <exception> #include <string> @@ -113,6 +119,7 @@ bool check_filedes(bool report) char buffer[256]; socklen_t addrlen = sizeof(buffer); +#ifdef HAVE_GETPEERNAME if(getpeername(d, (sockaddr*)buffer, &addrlen) != 0) { BOX_WARNING("Failed to getpeername(" << @@ -128,6 +135,7 @@ bool check_filedes(bool report) is_syslog_socket = true; } } +#endif // HAVE_GETPEERNAME } if(report && filedes_open[d] != OPEN) |