perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject [patch]avoid closing fd 0/1
Date Tue, 30 Mar 2010 17:10:36 GMT
Hi,

the patch below is a raw fix for the "mod_perl closes apache's stdin and/or 
stdout"-bug, see also

 http://www.gossamer-threads.com/lists/modperl/modperl/94921

Previously the code did something similar to

  open SAVEFH, '<&STDIN';
  close STDIN;
  ...
  open STDIN, '<&SAVEFH';

The idea is to change that into

  open SAVEFH, '<&='.fileno(STDIN);
  close STDIN;
  ...
  open STDIN, '<&='.fileno(SAVEFH);

This avoids calling dup().

This is the first time I do something Perl-IO-related in C. So, please review! 
One thing that I don't understand is the difference between IoIFP and IoOFP. 
Why does perl need 2 such structures to hold 1 file handle?

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net

Mime
View raw message