[Python-checkins] r85313 - python/branches/release31-maint/Modules/getpath.c

victor.stinner python-checkins at python.org
Fri Oct 8 01:39:04 CEST 2010


Author: victor.stinner
Date: Fri Oct  8 01:39:04 2010
New Revision: 85313

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

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


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

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


More information about the Python-checkins mailing list