mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
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.
This commit is contained in:
parent
c90397a7c9
commit
2a9a6b0e86
1 changed files with 1 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue