Initializes the length of machine name properly.
author <shinichiro.hamaji@gmail.com> <>
Wed, 29 Jul 2009 07:34:28 +0000 (07:34 +0000)
committer <shinichiro.hamaji@gmail.com> <>
Wed, 29 Jul 2009 07:34:28 +0000 (07:34 +0000)
This fix was suggested at (thanks!)

http://code.google.com/p/google-glog/issues/detail?id=9

git-svn-id: https://google-glog.googlecode.com/svn/trunk@62 eb4d4688-79bd-11dd-afb4-1d65580434c0

src/logging.cc

index 25e9a86..1c39c35 100644 (file)
@@ -177,8 +177,8 @@ static void GetHostName(string* hostname) {
   }
   *hostname = buf.nodename;
 #elif defined(OS_WINDOWS)
-  char buf[256];
-  DWORD len;
+  char buf[MAX_COMPUTERNAME_LENGTH + 1];
+  DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
   if (GetComputerNameA(buf, &len)) {
     *hostname = buf;
   } else {