]> granicus.if.org Git - python/commitdiff
#15965: Explicitly cast AT_FDCWD as (int).
authorTrent Nelson <trent@trent.me>
Wed, 19 Sep 2012 01:50:06 +0000 (21:50 -0400)
committerTrent Nelson <trent@trent.me>
Wed, 19 Sep 2012 01:50:06 +0000 (21:50 -0400)
Required on Solaris 10 (which defines AT_FDCWD as 0xffd19553),
harmless on other platforms.

Misc/NEWS
Modules/posixmodule.c

index 990f4d6c92f963dcd521234ec5bd2f1ea9250bda..90e3cc188c5855cb8cb0dc7441d962a0c1e491dd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.3.1
 Core and Builtins
 -----------------
 
+- Issue #15965: Explicitly cast AT_FDCWD as (int).  Required on Solaris 10
+  (which defines AT_FDCWD as 0xffd19553), harmless on other platforms.
+
 - Issue #15926: Fix crash after multiple reinitializations of the interpreter.
 
 - Issue #15895: Fix FILE pointer leak in one error branch of
index 54f6cd2b22cf9f619ff0836d07b59ddf787b80ab..e0efebfe1b046263cc738d33430427fdd063b3d6 100644 (file)
@@ -414,7 +414,14 @@ win32_warn_bytes_api()
 
 
 #ifdef AT_FDCWD
-#define DEFAULT_DIR_FD AT_FDCWD
+/*
+ * Why the (int) cast?  Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
+ * without the int cast, the value gets interpreted as uint (4291925331),
+ * which doesn't play nicely with all the initializer lines in this file that
+ * look like this:
+ *      int dir_fd = DEFAULT_DIR_FD;
+ */
+#define DEFAULT_DIR_FD (int)AT_FDCWD
 #else
 #define DEFAULT_DIR_FD (-100)
 #endif