summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-09-09 21:18:04 (GMT)
committerDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-09-09 21:18:04 (GMT)
commitc7937791a177a340b153dacd3140ddf8d838e170 (patch)
tree538641986a196505036f57b6db982409fb81db02
parent460ff3dd1c27b565fd5dd02edf43f97892cc7b79 (diff)
downloadcpython-c7937791a177a340b153dacd3140ddf8d838e170.zip
cpython-c7937791a177a340b153dacd3140ddf8d838e170.tar.gz
cpython-c7937791a177a340b153dacd3140ddf8d838e170.tar.bz2
Fix Issue #9752: MSVC compiler warning due to undefined function
(Patch by Jon Anglin)
-rw-r--r--Python/import.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index d6b19e8..d79fc52 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -25,6 +25,8 @@ extern "C" {
#ifdef MS_WINDOWS
/* for stat.st_mode */
typedef unsigned short mode_t;
+/* for _mkdir */
+#include <direct.h>
#endif
@@ -1134,9 +1136,6 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
time_t mtime = srcstat->st_mtime;
#ifdef MS_WINDOWS /* since Windows uses different permissions */
mode_t mode = srcstat->st_mode & ~S_IEXEC;
- mode_t dirmode = srcstat->st_mode | S_IEXEC; /* XXX Is this correct
- for Windows?
- 2010-04-07 BAW */
#else
mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH;
mode_t dirmode = (srcstat->st_mode |
@@ -1156,8 +1155,12 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
}
saved = *dirpath;
*dirpath = '\0';
- /* XXX call os.mkdir() or maybe CreateDirectoryA() on Windows? */
+
+#ifdef MS_WINDOWS
+ if (_mkdir(cpathname) < 0 && errno != EEXIST) {
+#else
if (mkdir(cpathname, dirmode) < 0 && errno != EEXIST) {
+#endif
*dirpath = saved;
if (Py_VerboseFlag)
PySys_WriteStderr(