From d58ee7e5c72c26b9ec81f2533d64cecd4b7959f8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 15 Apr 2013 22:36:49 +0200 Subject: [PATCH] os: unbreak windows build Windows doesn't have MAXHOSTNAMELEN. Introduced in afbadde. --- src/node_os.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/node_os.cc b/src/node_os.cc index d4399756b9..7f392a58fd 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -39,6 +39,11 @@ # include #endif +// Add Windows fallback. +#ifndef MAXHOSTNAMELEN +# define MAXHOSTNAMELEN 256 +#endif + namespace node { using namespace v8; @@ -62,6 +67,7 @@ static Handle GetHostname(const Arguments& args) { return ThrowException(ErrnoException(WSAGetLastError(), "gethostname")); #endif // __MINGW32__ } + buf[sizeof(buf) - 1] = '\0'; return scope.Close(String::New(buf)); }