[Python-checkins] r43511 - python/branches/release24-maint/Modules/posixmodule.c

thomas.wouters python-checkins at python.org
Sat Apr 1 00:39:56 CEST 2006


Author: thomas.wouters
Date: Sat Apr  1 00:39:56 2006
New Revision: 43511

Modified:
   python/branches/release24-maint/Modules/posixmodule.c
Log:

Backport trunk's r43510: In the fdopen(fd, 'a') case on UNIX, don't try to
set fd's flags to -1 if fcntl() and fdopen() both fail.



Modified: python/branches/release24-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release24-maint/Modules/posixmodule.c	(original)
+++ python/branches/release24-maint/Modules/posixmodule.c	Sat Apr  1 00:39:56 2006
@@ -5467,7 +5467,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