From 30177b879a800aa00efda92bca66c32ea95dc1bc Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Fri, 6 Mar 2015 10:17:26 +0100 Subject: [PATCH] make sure a listener is inheritable fix #978 --- gunicorn/sock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 337d5ff9..221126be 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -41,6 +41,11 @@ class BaseSocket(object): if not bound: self.bind(sock) sock.setblocking(0) + + # make sure that the socket can be inherited + if hasattr(sock, "set_inheritable"): + sock.set_inheritable(True) + sock.listen(self.conf.backlog) return sock @@ -110,6 +115,7 @@ class UnixSocket(BaseSocket): util.chown(self.cfg_addr, self.conf.uid, self.conf.gid) os.umask(old_umask) + def close(self): super(UnixSocket, self).close() os.unlink(self.cfg_addr)