components/python/python26/patches/Python26-15-getcwd.patch
author Rich Burridge <rich.burridge@oracle.com>
Wed, 30 May 2012 12:40:14 -0700
changeset 841 1a62cefa636d
parent 115 c360825c3a3f
permissions -rw-r--r--
7121707 python 2.6.4 should be updated to latest 2.6.X release

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)