Commit d4ca4fdb authored by Alex Martelli's avatar Alex Martelli

fixed wrong error checking on fcntl call as per SF bug # 821896

(same as commit of Sun Nov 2 to the release23-maint branch)
parent 7509c45c
...@@ -47,8 +47,9 @@ except (ImportError, AttributeError): ...@@ -47,8 +47,9 @@ except (ImportError, AttributeError):
pass pass
else: else:
def _set_cloexec(fd): def _set_cloexec(fd):
flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) try: flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
if flags >= 0: except IOError: pass
else:
# flags read successfully, modify # flags read successfully, modify
flags |= _fcntl.FD_CLOEXEC flags |= _fcntl.FD_CLOEXEC
_fcntl.fcntl(fd, _fcntl.F_SETFD, flags) _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment