mercurial/win32.py
changeset 35550 ed30934165c9
parent 35549 94a127152e25
child 37882 3a0f322af192
--- a/mercurial/win32.py	Tue Jan 02 12:02:25 2018 +0900
+++ b/mercurial/win32.py	Tue Jan 02 12:14:08 2018 +0900
@@ -439,7 +439,9 @@
     # realpath() calls GetFullPathName()
     realpath = os.path.realpath(path)
 
-    size = len(realpath) + 1
+    # allocate at least MAX_PATH long since GetVolumePathName('c:\\', buf, 4)
+    # somehow fails on Windows XP
+    size = max(len(realpath), _MAX_PATH) + 1
     buf = ctypes.create_string_buffer(size)
 
     if not _kernel32.GetVolumePathNameA(realpath, ctypes.byref(buf), size):