Skip to content

Commit 2300508

Browse files
committed
Issue4905: use INVALID_FILE_ATTRIBUTES where appropriate. (Patch by Ulrich Eckhardt)
1 parent 7d05236 commit 2300508

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ Maxim Dzumanenko
342342
Walter Dörwald
343343
Hans Eckardt
344344
Rodolpho Eckhardt
345+
Ulrich Eckhardt
345346
David Edelsohn
346347
John Edmonds
347348
Grant Edwards

Modules/posixmodule.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ _Py_Uid_Converter(PyObject *obj, void *p)
487487
* but this value would get interpreted as (uid_t)-1 by chown
488488
* and its siblings. That's not what the user meant! So we
489489
* throw an overflow exception instead. (We already
490-
* handled a real -1 with PyLong_AsLongAndOverflow() above.)
490+
* handled a real -1 with PyLong_AsLongAndOverflow() above.)
491491
*/
492492
if (uid == (uid_t)-1)
493493
goto overflow;
@@ -594,7 +594,7 @@ _Py_Gid_Converter(PyObject *obj, void *p)
594594
* but this value would get interpreted as (gid_t)-1 by chown
595595
* and its siblings. That's not what the user meant! So we
596596
* throw an overflow exception instead. (We already
597-
* handled a real -1 with PyLong_AsLongAndOverflow() above.)
597+
* handled a real -1 with PyLong_AsLongAndOverflow() above.)
598598
*/
599599
if (gid == (gid_t)-1)
600600
goto overflow;
@@ -2666,7 +2666,7 @@ os_access_impl(PyObject *self, path_t *path, int mode, int dir_fd, int effective
26662666
* (Directories cannot be read-only on Windows.)
26672667
*/
26682668
return_value = PyBool_FromLong(
2669-
(attr != 0xFFFFFFFF) &&
2669+
(attr != INVALID_FILE_ATTRIBUTES) &&
26702670
(!(mode & 2) ||
26712671
!(attr & FILE_ATTRIBUTE_READONLY) ||
26722672
(attr & FILE_ATTRIBUTE_DIRECTORY)));
@@ -2938,7 +2938,7 @@ posix_chmod(PyObject *self, PyObject *args, PyObject *kwargs)
29382938
attr = GetFileAttributesW(path.wide);
29392939
else
29402940
attr = GetFileAttributesA(path.narrow);
2941-
if (attr == 0xFFFFFFFF)
2941+
if (attr == INVALID_FILE_ATTRIBUTES)
29422942
result = 0;
29432943
else {
29442944
if (mode & _S_IWRITE)
@@ -7795,7 +7795,7 @@ posix_dup(PyObject *self, PyObject *args)
77957795

77967796
if (!PyArg_ParseTuple(args, "i:dup", &fd))
77977797
return NULL;
7798-
7798+
77997799
fd = _Py_dup(fd);
78007800
if (fd == -1)
78017801
return NULL;

0 commit comments

Comments
 (0)