Commit 2a9a6b0e authored by Thomas Wouters's avatar Thomas Wouters

In the fdopen(fd, 'a') case on UNIX, don't try to set fd's flags to -1 if

fcntl() and fdopen() both fail. Will backport.
parent c90397a7
......@@ -5777,7 +5777,7 @@ posix_fdopen(PyObject *self, PyObject *args)
if (flags != -1)
fcntl(fd, F_SETFL, flags | O_APPEND);
fp = fdopen(fd, mode);
if (fp == NULL)
if (fp == NULL && flags != -1)
/* restore old mode if fdopen failed */
fcntl(fd, F_SETFL, flags);
} else {
......
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