apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/unix filedup.c
Date Sat, 22 Mar 2003 02:30:43 GMT
wrowe       2003/03/21 18:30:42

  Modified:    file_io/unix filedup.c
  Log:
    Given two solutions to the current mpm inheritence bugs,
      1) track the target file's existing flags and register the proper
         sort of cleanup (a bug in the new design) or
      2) revert to the previous behavior and retain the existing cleanup
  
    I've gone with option 2, since Joe Orton has expressed concern with
    introducing too many changes in the coming release.  However, this
    implies that;
      apr_file_close(fd1);
      apr_file_dup2(fd1, fd2);
    is absolutely unsupported.  Since it wouldn't work on Win32 in the
    first place, I'm not terribly concerned about this limitation.
  
  Revision  Changes    Path
  1.62      +10 -8     apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/filedup.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- filedup.c	20 Mar 2003 22:04:01 -0000	1.61
  +++ filedup.c	22 Mar 2003 02:30:42 -0000	1.62
  @@ -109,6 +109,16 @@
       /* make sure unget behavior is consistent */
       (*new_file)->ungetchar = old_file->ungetchar;
   
  +    /* apr_file_dup2() retains the original cleanup, reflecting 
  +     * the existing inherit and nocleanup flags.  This means, 
  +     * that apr_file_dup2() cannot be called against an apr_file_t
  +     * already closed with apr_file_close, because the expected
  +     * cleanup was already killed.
  +     */
  +    if (which_dup == 2) {
  +        return APR_SUCCESS;
  +    }
  +
       /* apr_file_dup() clears the inherit attribute for normal files,
        * but sets the inherit attribute for std[out,in,err] fd's. 
        * The user must call apr_file_inherit_[un]set() on the dupped 
  @@ -139,14 +149,6 @@
   APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
                                           apr_file_t *old_file, apr_pool_t *p)
   {
  -    /* an existing apr_file_t may already be closed, and therefore
  -     * have no cleanup remaining; but we don't want to double-register
  -     * the same cleanup in _file_dup.  Kill the existing cleanup before
  -     * invoking _file_dup to the existing new_file.
  -     */
  -    apr_pool_cleanup_kill(new_file->pool, (void *)(new_file),
  -                          apr_unix_file_cleanup);
  -
       return _file_dup(&new_file, old_file, p, 2);
   }
   
  
  
  

Mime
View raw message