From: Alex Martelli Date: Sun, 2 Nov 2003 18:11:53 +0000 (+0000) Subject: fixed wrong error checking on fcntl call as per SF bug # 821896 X-Git-Tag: v2.3.3c1~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed7ca25add1e8108e11d0600803570b89100d8e8;p=thirdparty%2FPython%2Fcpython.git fixed wrong error checking on fcntl call as per SF bug # 821896 --- diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 756d8c87273e..41aa69a2673b 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -47,8 +47,9 @@ except (ImportError, AttributeError): pass else: def _set_cloexec(fd): - flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) - if flags >= 0: + try: flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) + except IOError: pass + else: # flags read successfully, modify flags |= _fcntl.FD_CLOEXEC _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)