Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
677898a3
Commit
677898a3
authored
Mar 02, 2001
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thanks to Steven Majewski, finally putting MacOS X imports to bed for 2.1b1.
parent
fd85a4e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
Python/import.c
Python/import.c
+3
-9
No files found.
Python/import.c
View file @
677898a3
...
...
@@ -1118,14 +1118,7 @@ case_ok(char *buf, int len, int namelen, char *name)
return
fss
.
name
[
0
]
>=
namelen
&&
strncmp
(
name
,
(
char
*
)
fss
.
name
+
1
,
namelen
)
==
0
;
/* new-fangled macintosh (macosx)
*
* XXX This seems prone to obscure errors, like suppose someone does
* XXX "import xyz", and in some directory there's both "XYZ.py" and
* XXX "xyz.txt". fopen("xyz.py") will open XYZ.py, but when marching thru
* XXX the directory we'll eventually "succeed" on "xyz.txt" because the
* XXX extension is never checked.
*/
/* new-fangled macintosh (macosx) */
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
DIR
*
dirp
;
struct
dirent
*
dp
;
...
...
@@ -1148,6 +1141,7 @@ case_ok(char *buf, int len, int namelen, char *name)
/* Open the directory and search the entries for an exact match. */
dirp
=
opendir
(
dirname
);
if
(
dirp
)
{
char
*
nameWithExt
=
buf
+
len
-
namelen
;
while
((
dp
=
readdir
(
dirp
))
!=
NULL
)
{
const
int
thislen
=
#ifdef _DIRENT_HAVE_D_NAMELEN
...
...
@@ -1156,7 +1150,7 @@ case_ok(char *buf, int len, int namelen, char *name)
strlen
(
dp
->
d_name
);
#endif
if
(
thislen
>=
namelen
&&
str
ncmp
(
dp
->
d_name
,
name
,
namelen
)
==
0
)
{
str
cmp
(
dp
->
d_name
,
nameWithExt
)
==
0
)
{
(
void
)
closedir
(
dirp
);
return
1
;
/* Found */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment