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

This commit is contained in:
Georg Brandl 2006-03-31 20:27:22 +00:00
parent 814727582a
commit 644b1e7aac
1 changed files with 4 additions and 0 deletions

View File

@ -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)
} 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();