]> granicus.if.org Git - python/commitdiff
Mark Hammond to the rescue:
authorGuido van Rossum <guido@python.org>
Wed, 3 May 2000 02:44:55 +0000 (02:44 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 3 May 2000 02:44:55 +0000 (02:44 +0000)
Checkin 2.131 of posixmodule.c changed os.stat on Windows, so that
"/bin/" type notation (trailing backslash) would work on Windows to
be consistent with Unix.

However, the patch broke the simple case of: os.stat("\\")

This did work in 1.5.2, and obviously should!

This patch addresses this, and restores the correct behaviour.

Modules/posixmodule.c

index b62cce03452868b4c5ff78e4e84c5b3eefb64637..1ca3826d752116f63705ba5593b070be378ddb0a 100644 (file)
@@ -567,10 +567,11 @@ posix_do_stat(self, args, format, statfunc)
        }
 
        if ((pathlen > 0) && (path[pathlen-1] == '\\' || path[pathlen-1] == '/')) {
-               /* exception for drive root */
-               if (!((pathlen == 3) &&
+               /* exception for specific or current drive root */
+               if (!((pathlen == 1) ||
+                     ((pathlen == 3) &&
                      (path[1] == ':') &&
-                     (path[2] == '\\' || path[2] == '/')))
+                     (path[2] == '\\' || path[2] == '/'))))
                {
                        strncpy(pathcopy, path, pathlen);
                        pathcopy[pathlen-1] = '\0'; /* nuke the trailing backslash */