mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fixes incorrect use of GetLastError where errno should be used.
This commit is contained in:
commit
9aa31d5479
1 changed files with 6 additions and 6 deletions
|
@ -733,7 +733,7 @@ get_inheritable(int fd, int raise)
|
|||
handle = (HANDLE)_get_osfhandle(fd);
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
if (raise)
|
||||
PyErr_SetFromWindowsErr(0);
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -788,10 +788,10 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
|
|||
|
||||
if (atomic_flag_works != NULL && !inheritable) {
|
||||
if (*atomic_flag_works == -1) {
|
||||
int inheritable = get_inheritable(fd, raise);
|
||||
if (inheritable == -1)
|
||||
int isInheritable = get_inheritable(fd, raise);
|
||||
if (isInheritable == -1)
|
||||
return -1;
|
||||
*atomic_flag_works = !inheritable;
|
||||
*atomic_flag_works = !isInheritable;
|
||||
}
|
||||
|
||||
if (*atomic_flag_works)
|
||||
|
@ -808,7 +808,7 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
|
|||
handle = (HANDLE)_get_osfhandle(fd);
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
if (raise)
|
||||
PyErr_SetFromWindowsErr(0);
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1167,7 @@ _Py_dup(int fd)
|
|||
#ifdef MS_WINDOWS
|
||||
handle = (HANDLE)_get_osfhandle(fd);
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
PyErr_SetFromWindowsErr(0);
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue