dougm       02/01/07 17:09:19

  Modified:    xs/APR/PerlIO apr_perlio.c
  Log:
  work around bug where some PerlIOAPR filehandles are still open during perl_destruct
  
  Revision  Changes    Path
  1.10      +14 -2     modperl-2.0/xs/APR/PerlIO/apr_perlio.c
  
  Index: apr_perlio.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/APR/PerlIO/apr_perlio.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_perlio.c      8 Jan 2002 01:06:20 -0000       1.9
  +++ apr_perlio.c      8 Jan 2002 01:09:19 -0000       1.10
  @@ -206,14 +206,26 @@
       IV code = PerlIOBase_close(aTHX_ f);
       apr_status_t rc;
   
  +#ifdef PERLIO_APR_DEBUG
       const char *new_path = NULL;
  -    apr_file_name_get(&new_path, st->file);
  +    if (!PL_dirty) {
  +        /* if this is called during perl_destruct we are in trouble */
  +        apr_file_name_get(&new_path, st->file);
  +    }
   
  -#ifdef PERLIO_APR_DEBUG
       Perl_warn(aTHX_ "PerlIOAPR_close obj=0x%lx, file=0x%lx, name=%s\n",
                 (unsigned long)f, (unsigned long)st->file,
                 new_path ? new_path : "(UNKNOWN)");
   #endif
  +
  +    if (PL_dirty) {
  +        /* there should not be any PerlIOAPR handles open
  +         * during perl_destruct
  +         */
  +        Perl_warn(aTHX_ "leaked PerlIOAPR handle 0x%lx",
  +                  (unsigned long)f);
  +        return -1;
  +    }
   
       rc = apr_file_flush(st->file);
       if (rc != APR_SUCCESS) {
  
  
  


Reply via email to