summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-03-14 18:39:18 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-03-14 18:39:18 (GMT)
commit9aa31d547920ead8cc52e861a1680f05d951c672 (patch)
tree7533436125b25bec6b2016543b6466062b8228fd /Python/fileutils.c
parent76c95a01dceb538b350de8ae70c3690cf0ca7d61 (diff)
parent41e7244c062e5acbb10582d12d3a03caa892f435 (diff)
downloadcpython-9aa31d547920ead8cc52e861a1680f05d951c672.zip
cpython-9aa31d547920ead8cc52e861a1680f05d951c672.tar.gz
cpython-9aa31d547920ead8cc52e861a1680f05d951c672.tar.bz2
Fixes incorrect use of GetLastError where errno should be used.
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 6502823..c6cdb19 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -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;
}