[Python-checkins] r43510 - python/trunk/Modules/posixmodule.c

thomas.wouters python-checkins at python.org
Sat Apr 1 00:38:21 CEST 2006


Author: thomas.wouters
Date: Sat Apr  1 00:38:19 2006
New Revision: 43510

Modified:
   python/trunk/Modules/posixmodule.c
Log:

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.



Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Sat Apr  1 00:38:19 2006
@@ -5777,7 +5777,7 @@
 		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 {


More information about the Python-checkins mailing list