httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@hyperreal.org
Subject cvs commit: apache-2.0/src/main http_log.c
Date Tue, 15 Feb 2000 22:51:28 GMT
stoddard    00/02/15 14:51:27

  Modified:    src/main http_log.c
  Log:
  ap_dupfile (specifically dup2) is not available in a general form under Windows.
  So use SetStdHandle directly. A single call to ap_dup2stderr() (or similar) could
  replace the entire chunk of code in the #ifdef #else #endif block.  Ryan didn't
  want to put this speciality function into APR, but we could put it into os.c
  if folks are interested.
  
  Revision  Changes    Path
  1.29      +15 -3     apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- http_log.c	2000/02/15 00:54:06	1.28
  +++ http_log.c	2000/02/15 22:51:23	1.29
  @@ -255,6 +255,7 @@
   
   void ap_open_logs(server_rec *s_main, ap_context_t *p)
   {
  +    ap_status_t rc = APR_SUCCESS;
       server_rec *virt, *q;
       int replace_stderr;
       ap_file_t *errfile = NULL;
  @@ -263,15 +264,26 @@
   
       replace_stderr = 1;
       if (s_main->error_log) {
  +#ifdef WIN32
  +        HANDLE hFile;
  +        ap_get_os_file(&hFile, s_main->error_log);
  +        FlushFileBuffers(hFile);
  +        if (!SetStdHandle(STD_ERROR_HANDLE, hFile)) {
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), s_main,
  +                         "unable to replace stderr with error_log");
  +        }
  +        replace_stderr = 0;
  +#else
           /* replace stderr with this new log */
           fflush(stderr); /* ToDo: replace this with an APR call... */
           ap_open_stderr(&errfile, p);        
  -        if (ap_dupfile(&errfile, s_main->error_log) != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
  +        if ((rc = ap_dupfile(&errfile, s_main->error_log)) != APR_SUCCESS) {
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main,
                            "unable to replace stderr with error_log");
           } else {
               replace_stderr = 0;
           }
  +#endif
       }
       /* note that stderr may still need to be replaced with something
        * because it points to the old error log, or back to the tty
  @@ -302,7 +314,7 @@
       ap_file_t *errfile = NULL;
   
       ap_open_stderr(&errfile, s->process->pool);        
  -    if (   s->error_log != NULL) {
  +    if (s->error_log != NULL) {
           ap_dupfile(&(s->error_log), errfile);
       }
   }
  
  
  

Mime
View raw message