summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-03-01 08:47:29 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-03-01 08:47:29 (GMT)
commitdbe6ebbeff8c9d9a8d138469aa63d8495bb78cc7 (patch)
treeb6b06718dba0cf4ddc883abc47ae7afcc6d18e2d /Python
parent8a18e99008c28156a7ba701ca8d6824a50fb0a9e (diff)
downloadcpython-dbe6ebbeff8c9d9a8d138469aa63d8495bb78cc7.zip
cpython-dbe6ebbeff8c9d9a8d138469aa63d8495bb78cc7.tar.gz
cpython-dbe6ebbeff8c9d9a8d138469aa63d8495bb78cc7.tar.bz2
More fiddling w/ the new-fangled Mac import code.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Python/import.c b/Python/import.c
index 1142875..b9637b2 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1111,16 +1111,19 @@ case_ok(char *buf, int len, int namelen, char *name)
#elif defined(__MACH__) && defined(__APPLE__)
DIR *dirp;
struct dirent *dp;
- char pathname[MAX_PATH + 1];
+ char pathname[MAXPATHLEN + 1];
const int pathlen = len - namelen - 1; /* don't want trailing SEP */
+ if (getenv("PYTHONCASEOK") != NULL)
+ return 1;
+
/* Copy the path component into pathname; substitute "." if empty */
if (pathlen <= 0) {
pathname[0] = '.';
pathname[1] = '\0';
}
else {
- assert(pathlen <= MAX_PATH);
+ assert(pathlen <= MAXPATHLEN);
memcpy(pathname, buf, pathlen);
pathname[pathlen] = '\0';
}
@@ -1128,18 +1131,19 @@ case_ok(char *buf, int len, int namelen, char *name)
dirp = opendir(pathname);
if (dirp) {
while ((dp = readdir(dirp)) != NULL) {
+ const int thislen =
#ifdef _DIRENT_HAVE_D_NAMELEN
- const int thislen = dp->d_namlen;
+ dp->d_namlen;
#else
- const int thislen = strlen(dp->d_name);
+ strlen(dp->d_name);
#endif
if (thislen == namelen && !strcmp(dp->d_name, name)) {
(void)closedir(dirp);
return 1; /* Found */
}
}
+ (void)closedir(dirp);
}
- (void)closedir(dirp);
return 0 ; /* Not found */
/* assuming it's a case-sensitive filesystem, so there's nothing to do! */