On Wed, Aug 20, 2008 at 01:27:37AM -0700, Eric Wong wrote:
> Jos Backus <[EMAIL PROTECTED]> wrote:
> > On Mon, Aug 18, 2008 at 02:59:21PM -0700, Eric Wong wrote:
> > > This probably works:
> > > 
> > > diff --git a/lib/mongrel.rb b/lib/mongrel.rb
> > > index 8b5dfe2..027bfdb 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
> > 
> > Looks reasonable to me. Thanks, Eric. Can somebody commit, please?
> 
> I've just committed it, r1036 to trunk.  Thanks for the report!

Thanks Eric. The patch is probably incomplete, as I just noticed a problem:

/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:94:in
`initialize': uninitialized constant Mongrel::HttpServer::Fcntl (NameError)

That code doesn't have the defined? test. But even if it did, it wouldn't work
as `fcntl' hadn't been require'd so the Fcntl::FD_CLOEXEC constant couldn't be
available until it was (if it was available).

So the right thing to do is to also apply this patch which explicitly
require's `fcntl':

--- mongrel.rb- 2008-11-04 15:39:01.000000000 -0500
+++ mongrel.rb  2008-11-04 15:26:38.000000000 -0500
@@ -7,6 +7,7 @@
 require 'etc'
 require 'uri'
 require 'stringio'
+require 'fcntl'
    
 # Compiled Mongrel extension
 require 'http11'

-- 
Jos Backus
jos at catnook.com
_______________________________________________
Mongrel-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-development

Reply via email to