]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fixed wrong error checking on fcntl call as per SF bug # 821896
authorAlex Martelli <aleaxit@gmail.com>
Sun, 9 Nov 2003 16:44:09 +0000 (16:44 +0000)
committerAlex Martelli <aleaxit@gmail.com>
Sun, 9 Nov 2003 16:44:09 +0000 (16:44 +0000)
(same as commit of Sun Nov 2 to the release23-maint branch)

Lib/tempfile.py

index 472fd83155b201c78fba655f7061239413408dff..1405a7f742439bba76fa7bdc591b95f64cfc1b71 100644 (file)
@@ -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)