From 61a84eece37a46c659d3dff48394347a0fcbd932 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 15 Mar 2010 22:59:26 -0400 Subject: [PATCH] Be more considerate to future me. Sergey points out that its more proper to |= with the current value of the fd flags. I concur. --- gunicorn/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index 0b5a1f44..4f809571 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -76,7 +76,9 @@ def get_maxfd(): return maxfd def close_on_exec(fd): - fcntl.fcntl(fd, fcntl.F_SETFD, fcntl.FD_CLOEXEC) + 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