os: unbreak windows build

Windows doesn't have MAXHOSTNAMELEN. Introduced in afbadde.
This commit is contained in:
Ben Noordhuis
2013-04-15 22:36:49 +02:00
parent afbaddecd3
commit d58ee7e5c7

View File

@@ -39,6 +39,11 @@
# include <sys/utsname.h>
#endif
// Add Windows fallback.
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 256
#endif
namespace node {
using namespace v8;
@@ -62,6 +67,7 @@ static Handle<Value> GetHostname(const Arguments& args) {
return ThrowException(ErrnoException(WSAGetLastError(), "gethostname"));
#endif // __MINGW32__
}
buf[sizeof(buf) - 1] = '\0';
return scope.Close(String::New(buf));
}