about summary refs log tree commit homepage
path: root/lib/mongrel.rb
diff options
context:
space:
mode:
authornormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-08-20 08:20:53 +0000
committernormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-08-20 08:20:53 +0000
commitf935315563751c7afcb2f773372645efa0c9d63d (patch)
tree7089e88750bc507746401b073dd224cdd458a0b7 /lib/mongrel.rb
parent1408a7d47ffb9a455f9570d884213198d757ac8e (diff)
downloadunicorn-f935315563751c7afcb2f773372645efa0c9d63d.tar.gz
Original patch from Jos Backus, modified to work on weird platforms
where Fcntl::FD_CLOEXEC may not be defined.

Jos Backus wrote:
> Mongrel, at least in 1.1.4, doesn't set the close-on-exec flag
> on the listen socket. This leads to trouble in programs that
> use Mongrel and fork other programs (like puppetmasterd, part
> of Puppet). For an example, see
> http://groups.google.com/group/puppet-dev/browse_thread/thread/463f0f8cfc80cc43

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@1036 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel.rb')
-rw-r--r--lib/mongrel.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index 1963322..8d815cc 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -91,6 +91,9 @@ module Mongrel
       
       tries = 0
       @socket = TCPServer.new(host, port)
+      if defined?(Fcntl::FD_CLOEXEC)
+        @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+      end
       
       @classifier = URIClassifier.new
       @host = host