mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
fixed wrong error checking on fcntl call as per SF bug # 821896
(same as commit of Sun Nov 2 to the release23-maint branch)
This commit is contained in:
parent
0c5b4ad8f2
commit
f09994e527
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue