apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: cvs commit: httpd-2.0/server/mpm/worker pod.c
Date Fri, 21 Mar 2003 17:37:48 GMT
At 10:48 AM 3/21/2003, Jeff Trawick wrote:
>Joe Orton wrote:
>>
>>In the r1.57 filedup.c change, a cleanup is registered for the "new"  
>>fd coming out of apr_file_dup2(), which wasn't happening previously.  
>>I'm guessing that this cleanup is closing fd 2 when pconf is cleared, or
>>something like that.
>
>backtracking uses of fd 2 up through this time is somewhat funny
>
>it looks like
>
>a) we set the error log to file descriptor 2
>
>b) we close file descriptor 2 and set it to /dev/null via the freopen() in apr_proc_detach
>
>c) we close file descriptor 2 (because of cleanup registered around step a??)

Bang.  We are dup2()ing that fd, and that fd didn't have a cleanup
(in fact it was opened APR_FILE_NOCLOSE).

Attached is a patch that uses the logic

  apr_file_dup() always registers a cleanup, inherited for 0..2, 
  otherwise not inherited by default.

  apr_file_dup2() registers the same cleanup the original open()
  or the toggled apr_file_inherit_[un]set had indicated.  We still
  don't trust the original cleanup, but register the 'proper' one
  based on the desired behavior of that target apr_file_t.

Give it a whirl and I will commit if you folks concur.

Bill 
Mime
View raw message