From 86518c3b1101a20fafb8d213d0d68988cb4407fe Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 21 Dec 2010 00:07:02 +0100 Subject: [PATCH] Port GetHostName --- src/node_os.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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")); }