diff --git a/gunicorn/util.py b/gunicorn/util.py index 751deea71..40ea00728 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -256,9 +256,10 @@ def parse_address(netloc, default_port='8000'): def close_on_exec(fd): - flags = fcntl.fcntl(fd, fcntl.F_GETFD) - flags |= fcntl.FD_CLOEXEC - fcntl.fcntl(fd, fcntl.F_SETFD, flags) + # available since Python 3.4, equivalent to either: + # ioctl(fd, FIOCLEX) + # fcntl(fd, fcntl.F_SETFD, fcntl.FD_CLOEXEC) + os.set_inheritable(fd, False) def set_non_blocking(fd):