components/python/python26/patches/Python26-15-getcwd.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 841 1a62cefa636d
permissions -rw-r--r--
Close of build 10.
diff --git Python-2.6.4/Modules/posixmodule.c Python-2.6.4/Modules/posixmodule.c
--- Python-2.6.4/Modules/posixmodule.c
+++ Python-2.6.4/Modules/posixmodule.c
@@ -1997,6 +1997,8 @@
     char *res = NULL;
     PyObject *dynamic_return;
 
+    int maxsize = pathconf(".", _PC_PATH_MAX);
+
     Py_BEGIN_ALLOW_THREADS
     do {
         bufsize = bufsize + bufsize_incr;
@@ -2013,7 +2015,7 @@
         if (res == NULL) {
             free(tmpbuf);
         }
-    } while ((res == NULL) && (errno == ERANGE));
+    } while ((res == NULL) && (errno == ERANGE) && (bufsize < maxsize));
     Py_END_ALLOW_THREADS
 
     if (res == NULL)