perl-dev mailing list archives

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

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

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! (

Like fantasy?

View raw message