summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-03-31 22:38:19 (GMT)
committerThomas Wouters <thomas@python.org>2006-03-31 22:38:19 (GMT)
commit2a9a6b0e86320ba0793051f3050034ae4290c764 (patch)
treeea8e67e7bd8a8cbea8c007e54e126be451af8dd7 /Modules
parentc90397a7c924355052f1331360502a668bc1e69d (diff)
downloadcpython-2a9a6b0e86320ba0793051f3050034ae4290c764.zip
cpython-2a9a6b0e86320ba0793051f3050034ae4290c764.tar.gz
cpython-2a9a6b0e86320ba0793051f3050034ae4290c764.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index a27a2af..50ee0e3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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 {