diff --git a/gunicorn/util.py b/gunicorn/util.py index 75224f82..9850c773 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -101,8 +101,9 @@ def get_maxfd(): return maxfd def close_on_exec(fd): - flags = fcntl.fcntl(fd, fcntl.F_GETFD) | fcntl.FD_CLOEXEC - fcntl.fcntl(fd, fcntl.F_SETFL, flags) + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + flags |= fcntl.FD_CLOEXEC + fcntl.fcntl(fd, fcntl.F_SETFD, flags) def set_non_blocking(fd): flags = fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK