diff --git a/src/node_os.cc b/src/node_os.cc index 68b08959ac..2c17d33c81 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -4,7 +4,12 @@ #include #include -#include // gethostname + +#ifdef __POSIX__ +# include // gethostname +#else // __MINGW32__ +# include // gethostname +#endif // __MINGW32__ namespace node { @@ -16,6 +21,9 @@ static Handle GetHostname(const Arguments& args) { int r = gethostname(s, 255); if (r < 0) { +#ifdef __MINGW32__ + errno = WSAGetLastError() - WSABASEERR; +#endif return ThrowException(ErrnoException(errno, "gethostname")); }