httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/file_io/win32 filedup.c
Date Thu, 04 May 2000 21:35:59 GMT
ake         00/05/04 14:35:59

  Modified:    src/lib/apr/file_io/win32 filedup.c
  Log:
  prevent trap when restarting under debugger
  
  Revision  Changes    Path
  1.17      +9 -2      apache-2.0/src/lib/apr/file_io/win32/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filedup.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- filedup.c	2000/04/28 15:24:40	1.16
  +++ filedup.c	2000/05/04 21:35:58	1.17
  @@ -60,6 +60,7 @@
   
   ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file, ap_pool_t *p)
   {
  +    BOOLEAN isStdHandle = FALSE;
       HANDLE hCurrentProcess = GetCurrentProcess();
   
       if ((*new_file) == NULL) {
  @@ -84,14 +85,17 @@
            * can, however, emulate dup2 for the standard i/o handles.
            */
           if (hFile == GetStdHandle(STD_ERROR_HANDLE)) {
  +            isStdHandle = TRUE;
               if (!SetStdHandle(STD_ERROR_HANDLE, old_file->filehand))
                   return GetLastError();
           }
           else if (hFile == GetStdHandle(STD_OUTPUT_HANDLE)) {
  +            isStdHandle = TRUE;
               if (!SetStdHandle(STD_OUTPUT_HANDLE, old_file->filehand))
                   return GetLastError();
           }
           else if (hFile == GetStdHandle(STD_INPUT_HANDLE)) {
  +            isStdHandle = TRUE;
               if (!SetStdHandle(STD_INPUT_HANDLE, old_file->filehand))
                   return GetLastError();
           }
  @@ -111,8 +115,11 @@
       (*new_file)->atime = old_file->atime;    
       (*new_file)->mtime = old_file->mtime;
       (*new_file)->ctime = old_file->ctime;
  -    ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup,
  -                        ap_null_cleanup);
  +
  +    if (!isStdHandle) {
  +        ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup,
  +                            ap_null_cleanup);
  +    }
   
       return APR_SUCCESS;
   }
  
  
  

Mime
View raw message