From: Nick Mathewson Date: Thu, 2 Sep 2010 15:10:50 +0000 (-0400) Subject: Use the _func() replacements for open, fstat, etc in evutil.c on win32 X-Git-Tag: release-2.0.7-rc~16^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e50c0fcc85245881eb67dacb5f5e54e0b2482655;p=libevent Use the _func() replacements for open, fstat, etc in evutil.c on win32 Remember that in a fit of ANSI C compliance, Microsoft decided to screw portability by renaming basically all the functions in unistd.h to get prefixed with an understore. For some reason, mingw didn't seem to mind, but at least some people's compilers did: see bug 3044490. --- diff --git a/evdns.c b/evdns.c index 1248d2ae..12e4bdae 100644 --- a/evdns.c +++ b/evdns.c @@ -124,12 +124,6 @@ #define u16 ev_uint16_t #define u8 ev_uint8_t -#ifdef WIN32 -#define open _open -#define read _read -#define close _close -#endif - /* maximum number of addresses from a single packet */ /* that we bother recording */ #define MAX_V4_ADDRS 32 diff --git a/evutil.c b/evutil.c index 16ac3449..b14b9e49 100644 --- a/evutil.c +++ b/evutil.c @@ -78,6 +78,14 @@ #include "strlcpy-internal.h" #include "ipv6-internal.h" +#ifdef WIN32 +#define open _open +#define read _read +#define close _close +#define fstat _fstat +#define stat _stat +#endif + /** Read the contents of 'filename' into a newly allocated NUL-terminated string. Set *content_out to hold this string, and *len_out to hold its