diff options
author | Alex Martelli <aleaxit@gmail.com> | 2003-11-09 16:44:09 (GMT) |
---|---|---|
committer | Alex Martelli <aleaxit@gmail.com> | 2003-11-09 16:44:09 (GMT) |
commit | f09994e5273e358c5fc764db681bd3dafecc3e2d (patch) | |
tree | cbc25c6168dcaaf08fed6c168e447bbea923fd16 /Lib | |
parent | 0c5b4ad8f2c83b8c7731731ae0ed48b95da9515e (diff) | |
download | cpython-f09994e5273e358c5fc764db681bd3dafecc3e2d.zip cpython-f09994e5273e358c5fc764db681bd3dafecc3e2d.tar.gz cpython-f09994e5273e358c5fc764db681bd3dafecc3e2d.tar.bz2 |
fixed wrong error checking on fcntl call as per SF bug # 821896
(same as commit of Sun Nov 2 to the release23-maint branch)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/tempfile.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 472fd83..1405a7f 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) |