Commit 644b1e7a authored by Georg Brandl's avatar Georg Brandl

Add guards against fcntl() not being available on Windows.

parent 81472758
...@@ -5769,6 +5769,7 @@ posix_fdopen(PyObject *self, PyObject *args) ...@@ -5769,6 +5769,7 @@ posix_fdopen(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H)
if (mode[0] == 'a') { if (mode[0] == 'a') {
/* try to make sure the O_APPEND flag is set */ /* try to make sure the O_APPEND flag is set */
int flags; int flags;
...@@ -5782,6 +5783,9 @@ posix_fdopen(PyObject *self, PyObject *args) ...@@ -5782,6 +5783,9 @@ posix_fdopen(PyObject *self, PyObject *args)
} else { } else {
fp = fdopen(fd, mode); fp = fdopen(fd, mode);
} }
#else
fp = fdopen(fd, mode);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (fp == NULL) if (fp == NULL)
return posix_error(); return posix_error();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment