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
b4f39eea
Commit
b4f39eea
authored
Jun 23, 2013
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
20b0f87e
5b2f1841
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
41 deletions
+16
-41
Include/pyport.h
Include/pyport.h
+8
-7
Modules/_io/fileio.c
Modules/_io/fileio.c
+1
-1
Modules/_stat.c
Modules/_stat.c
+5
-31
Modules/posixmodule.c
Modules/posixmodule.c
+2
-2
No files found.
Include/pyport.h
View file @
b4f39eea
...
@@ -393,9 +393,15 @@ typedef size_t Py_uhash_t;
...
@@ -393,9 +393,15 @@ typedef size_t Py_uhash_t;
#include <stat.h>
#include <stat.h>
#endif
#endif
#if
defined(PYCC_VACPP)
#if
ndef S_IFMT
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
#define S_IFMT 0170000
#endif
#ifndef S_IFLNK
/* Windows doesn't define S_IFLNK but posixmodule.c maps
* IO_REPARSE_TAG_SYMLINK to S_IFLNK */
# define S_IFLNK 0120000
#endif
#endif
#ifndef S_ISREG
#ifndef S_ISREG
...
@@ -410,11 +416,6 @@ typedef size_t Py_uhash_t;
...
@@ -410,11 +416,6 @@ typedef size_t Py_uhash_t;
#define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR)
#define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR)
#endif
#endif
#ifndef S_ISBLK
#define S_ISBLK(x) (((x) & S_IFMT) == S_IFBLK)
#endif
#ifdef __cplusplus
#ifdef __cplusplus
/* Move this down here since some C++ #include's don't like to be included
/* Move this down here since some C++ #include's don't like to be included
inside an extern "C" */
inside an extern "C" */
...
...
Modules/_io/fileio.c
View file @
b4f39eea
...
@@ -171,7 +171,7 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
...
@@ -171,7 +171,7 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static
int
static
int
dircheck
(
fileio
*
self
,
PyObject
*
nameobj
)
dircheck
(
fileio
*
self
,
PyObject
*
nameobj
)
{
{
#if defined(HAVE_FSTAT) && defined(S_I
F
DIR) && defined(EISDIR)
#if defined(HAVE_FSTAT) && defined(S_I
S
DIR) && defined(EISDIR)
struct
stat
buf
;
struct
stat
buf
;
if
(
self
->
fd
<
0
)
if
(
self
->
fd
<
0
)
return
0
;
return
0
;
...
...
Modules/_stat.c
View file @
b4f39eea
...
@@ -39,35 +39,18 @@ typedef unsigned short mode_t;
...
@@ -39,35 +39,18 @@ typedef unsigned short mode_t;
*
*
* Only the names are defined by POSIX but not their value. All common file
* Only the names are defined by POSIX but not their value. All common file
* types seems to have the same numeric value on all platforms, though.
* types seems to have the same numeric value on all platforms, though.
*
* pyport.h guarantees S_IFMT, S_IFDIR, S_IFCHR, S_IFREG and S_IFLNK
*/
*/
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
#ifndef S_IFDIR
# define S_IFDIR 0040000
#endif
#ifndef S_IFCHR
# define S_IFCHR 0020000
#endif
#ifndef S_IFBLK
#ifndef S_IFBLK
# define S_IFBLK 0060000
# define S_IFBLK 0060000
#endif
#endif
#ifndef S_IFREG
# define S_IFREG 0100000
#endif
#ifndef S_IFIFO
#ifndef S_IFIFO
# define S_IFIFO 0010000
# define S_IFIFO 0010000
#endif
#endif
#ifndef S_IFLNK
# define S_IFLNK 0120000
#endif
#ifndef S_IFSOCK
#ifndef S_IFSOCK
# define S_IFSOCK 0140000
# define S_IFSOCK 0140000
#endif
#endif
...
@@ -85,23 +68,14 @@ typedef unsigned short mode_t;
...
@@ -85,23 +68,14 @@ typedef unsigned short mode_t;
#endif
#endif
/* S_ISXXX() */
/* S_ISXXX()
#ifndef S_ISDIR
* pyport.h defines S_ISDIR(), S_ISREG() and S_ISCHR()
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
*/
#endif
#ifndef S_ISCHR
# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#endif
#ifndef S_ISBLK
#ifndef S_ISBLK
# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#endif
#endif
#ifndef S_ISREG
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISFIFO
#ifndef S_ISFIFO
# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#endif
#endif
...
...
Modules/posixmodule.c
View file @
b4f39eea
...
@@ -1405,9 +1405,9 @@ attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag, stru
...
@@ -1405,9 +1405,9 @@ attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag, stru
result
->
st_ino
=
(((
__int64
)
info
->
nFileIndexHigh
)
<<
32
)
+
info
->
nFileIndexLow
;
result
->
st_ino
=
(((
__int64
)
info
->
nFileIndexHigh
)
<<
32
)
+
info
->
nFileIndexLow
;
if
(
reparse_tag
==
IO_REPARSE_TAG_SYMLINK
)
{
if
(
reparse_tag
==
IO_REPARSE_TAG_SYMLINK
)
{
/* first clear the S_IFMT bits */
/* first clear the S_IFMT bits */
result
->
st_mode
^=
(
result
->
st_mode
&
0170000
);
result
->
st_mode
^=
(
result
->
st_mode
&
S_IFMT
);
/* now set the bits that make this a symlink */
/* now set the bits that make this a symlink */
result
->
st_mode
|=
0120000
;
result
->
st_mode
|=
S_IFLNK
;
}
}
return
0
;
return
0
;
...
...
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