]> granicus.if.org Git - python/commitdiff
Issue #27781: Fixes uninitialized fd when !MS_WINDOWS and !HAVE_OPENAT
authorSteve Dower <steve.dower@microsoft.com>
Fri, 9 Sep 2016 16:03:15 +0000 (09:03 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Fri, 9 Sep 2016 16:03:15 +0000 (09:03 -0700)
Modules/posixmodule.c

index c1ba7ba9a64ddfc5b95619800880d02404306695..ce646846dfbe83ae3e4813614fd6e3431b34cfd4 100644 (file)
@@ -7477,13 +7477,14 @@ os_open_impl(PyObject *module, path_t *path, int flags, int mode, int dir_fd)
         Py_BEGIN_ALLOW_THREADS
 #ifdef MS_WINDOWS
         fd = _wopen(path->wide, flags, mode);
-#endif
+#else
 #ifdef HAVE_OPENAT
         if (dir_fd != DEFAULT_DIR_FD)
             fd = openat(dir_fd, path->narrow, flags, mode);
         else
+#endif /* HAVE_OPENAT */
             fd = open(path->narrow, flags, mode);
-#endif
+#endif /* !MS_WINDOWS */
         Py_END_ALLOW_THREADS
     } while (fd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
     _Py_END_SUPPRESS_IPH