[Python-checkins] r85312 - python/branches/release27-maint/Modules/getpath.c

victor.stinner python-checkins at python.org
Fri Oct 8 01:37:09 CEST 2010


Author: victor.stinner
Date: Fri Oct  8 01:37:08 2010
New Revision: 85312

Log:
copy_absolute(): keep the relative path if getcwd() failed

Instead of using the undefined content of the 'path' buffer.


Modified:
   python/branches/release27-maint/Modules/getpath.c

Modified: python/branches/release27-maint/Modules/getpath.c
==============================================================================
--- python/branches/release27-maint/Modules/getpath.c	(original)
+++ python/branches/release27-maint/Modules/getpath.c	Fri Oct  8 01:37:08 2010
@@ -232,7 +232,11 @@
     if (p[0] == SEP)
         strcpy(path, p);
     else {
-        getcwd(path, MAXPATHLEN);
+        if (!getcwd(path, MAXPATHLEN)) {
+            /* unable to get the current directory */
+            strcpy(path, p);
+            return;
+        }
         if (p[0] == '.' && p[1] == SEP)
             p += 2;
         joinpath(path, p);


More information about the Python-checkins mailing list