From 09b5dd2ad1fde7c520c716e668fd95758d763220 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 15 Mar 2010 22:12:54 -0400 Subject: [PATCH] Fix close_on_exec bug. Reported by Sergey Shepelev. I changed his patch slightly because of the man page language. As I read things, the close on exec flag is separate from the F_SETFL flags. --- THANKS | 3 ++- gunicorn/util.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/THANKS b/THANKS index dfed3069..cee470eb 100644 --- a/THANKS +++ b/THANKS @@ -7,4 +7,5 @@ suggesting improvements or submitting changes. Some of these people are: Curt Micol Eric Florenzano Johan Bergström -Xavier Grangier \ No newline at end of file +Xavier Grangier +Sergey Shepelev diff --git a/gunicorn/util.py b/gunicorn/util.py index 2c2b7099..0b5a1f44 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -76,8 +76,7 @@ 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) + fcntl.fcntl(fd, fcntl.F_SETFD, fcntl.FD_CLOEXEC) def set_non_blocking(fd): flags = fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK