apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: apr/file_io/unix open.c
Date Mon, 01 Oct 2001 18:46:40 GMT
jwoolley    01/10/01 11:46:40

  Modified:    .        CHANGES
               file_io/unix open.c
  Log:
  Fix a potential segfault on Unix when apr_file_close() is called and the
  file_cleanup fails.  Previously in that situation the cleanup would not
  be deregistered and therefore it would get run again when the pool went
  away.  Similar behavior in the directory cleanup logic caused segfaults
  at some point in the past.
  
  Reviewed by:	Ryan Bloom, Bill Rowe
  
  Revision  Changes    Path
  1.164     +5 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.163
  retrieving revision 1.164
  diff -u -d -u -r1.163 -r1.164
  --- CHANGES	2001/09/28 15:22:34	1.163
  +++ CHANGES	2001/10/01 18:46:40	1.164
  @@ -1,5 +1,10 @@
   Changes with APR b1  
   
  +  *) Fix potential segfault when closing a file on Unix.  If
  +     apr_file_close() was called and it failed, it would not
  +     deregister the file cleanup.  Therefore the cleanup would
  +     be run again later on a now-invalid descriptor.  [Cliff Woolley]
  +
     *) Introduce apr_pool_lock for debugging, in combination with
        ALLOC_USE_MALLOC + DEBUG_WITH_MPROTECT.  Only implemented
        on Win32 today, very effective for debugging pool constness.
  
  
  
  1.85      +2 -7      apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -d -u -r1.84 -r1.85
  --- open.c	2001/08/10 21:04:47	1.84
  +++ open.c	2001/10/01 18:46:40	1.85
  @@ -174,13 +174,8 @@
   
   APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file)
   {
  -    apr_status_t rv;
  -
  -    if ((rv = apr_unix_file_cleanup(file)) == APR_SUCCESS) {
  -        apr_pool_cleanup_kill(file->cntxt, file, apr_unix_file_cleanup);
  -        return APR_SUCCESS;
  -    }
  -    return rv;
  +    apr_pool_cleanup_kill(file->cntxt, file, apr_unix_file_cleanup);
  +    return apr_unix_file_cleanup(file);
   }
   
   APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont)
  
  
  

Mime
View raw message