From df330c00577fed3c16be92129891f08f56441aef Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 May 2009 22:43:22 -0700 Subject: app/exec_cgi: GC prevention Don't allow newly created IO objects to get GC'ed and subsequently close(2)-ed. We're not reopening the {$std,STD}{in,out,err} variables since those can't be trusted to have fileno 1, 2 and 3 respectively. --- lib/unicorn/app/exec_cgi.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb index f5e7db9..d98b3e4 100644 --- a/lib/unicorn/app/exec_cgi.rb +++ b/lib/unicorn/app/exec_cgi.rb @@ -69,9 +69,9 @@ module Unicorn::App ENV['GATEWAY_INTERFACE'] = 'CGI/1.1' env.keys.grep(/^HTTP_/) { |key| ENV[key] = env[key] } - IO.new(0).reopen(inp) - IO.new(1).reopen(out) - IO.new(2).reopen(err) + a = IO.new(0).reopen(inp) + b = IO.new(1).reopen(out) + c = IO.new(2).reopen(err) exec(*@args) end -- cgit v1.2.3-24-ge0c7