httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server core.c log.c
Date Sun, 15 Sep 2002 22:04:01 GMT
wrowe       2002/09/15 15:04:01

  Modified:    include  http_log.h
               server   core.c log.c
  Log:
    Modify ap_open_logs (an internal function) to follow the hook open_logs
    argument schema so it can be directly invoked by the hook handler.  Also
    clean up the open_logs processing to return an error rather than simply
    exit()ing.
  
  Revision  Changes    Path
  1.41      +7 -2      httpd-2.0/include/http_log.h
  
  Index: http_log.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_log.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- http_log.h	30 Jul 2002 18:14:47 -0000	1.40
  +++ http_log.h	15 Sep 2002 22:04:01 -0000	1.41
  @@ -148,10 +148,15 @@
   
   /**
    * Open the error log and replace stderr with it.
  + * @param pconf Not used
  + * @param plog  The pool to allocate the logs from
  + * @param ptemp Pool used for temporary allocations
    * @param s_main The main server
  - * @param p The pool to allocate out of
  + * @tip ap_open_logs isn't expected to be used by modules, it is
  + * an internal core function 
    */
  -void ap_open_logs (server_rec *s_main, apr_pool_t *p);
  +int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog, 
  +                 apr_pool_t *ptemp, server_rec *s_main);
   
   /* 
    * The three primary logging functions, ap_log_error, ap_log_rerror, and 
  
  
  
  1.204     +1 -7      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.203
  retrieving revision 1.204
  diff -u -r1.203 -r1.204
  --- core.c	15 Sep 2002 00:30:56 -0000	1.203
  +++ core.c	15 Sep 2002 22:04:01 -0000	1.204
  @@ -3932,12 +3932,6 @@
       return OK;
   }
   
  -static int core_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
  -{
  -    ap_open_logs(s, plog);
  -    return OK;
  -}
  -
   static void core_insert_filter(request_rec *r)
   {
       core_dir_config *conf = (core_dir_config *)
  @@ -4111,7 +4105,7 @@
       ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST);
       ap_hook_translate_name(ap_core_translate,NULL,NULL,APR_HOOK_REALLY_LAST);
       ap_hook_map_to_storage(core_map_to_storage,NULL,NULL,APR_HOOK_REALLY_LAST);
  -    ap_hook_open_logs(core_open_logs,NULL,NULL,APR_HOOK_MIDDLE);
  +    ap_hook_open_logs(ap_open_logs,NULL,NULL,APR_HOOK_REALLY_FIRST);
       ap_hook_handler(default_handler,NULL,NULL,APR_HOOK_REALLY_LAST);
       /* FIXME: I suspect we can eliminate the need for these do_nothings - Ben */
       ap_hook_type_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST);
  
  
  
  1.126     +18 -10    httpd-2.0/server/log.c
  
  Index: log.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/log.c,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- log.c	10 Jul 2002 06:01:11 -0000	1.125
  +++ log.c	15 Sep 2002 22:04:01 -0000	1.126
  @@ -197,7 +197,7 @@
           ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT,
                        APR_EBADPATH, NULL, "Invalid -E error log file %s",
                        fname);
  -        exit(1);
  +        return APR_EBADPATH;
       }
       if ((rc = apr_file_open(&stderr_file, filename,
                               APR_APPEND | APR_READ | APR_WRITE | APR_CREATE,
  @@ -254,7 +254,7 @@
       return rc;
   }
   
  -static void open_error_log(server_rec *s, apr_pool_t *p)
  +static int open_error_log(server_rec *s, apr_pool_t *p)
   {
       const char *fname;
       int rc;
  @@ -267,7 +267,7 @@
           if (rc != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
                            "Couldn't start ErrorLog process");
  -            exit(1);
  +            return DONE;
           }
   
           s->error_log = dummy;
  @@ -284,7 +284,7 @@
                       openlog(ap_server_argv0, LOG_NDELAY|LOG_CONS|LOG_PID,
                               fac->t_val);
                       s->error_log = NULL;
  -                    return;
  +                    return OK;
                   }
               }
           }
  @@ -301,7 +301,7 @@
               ap_log_error(APLOG_MARK, APLOG_STARTUP, APR_EBADPATH, NULL,
                            "%s: Invalid error log path %s.",
                            ap_server_argv0, s->error_fname);
  -            exit(1);
  +            return DONE;
           }
           if ((rc = apr_file_open(&s->error_log, fname,
                                  APR_APPEND | APR_READ | APR_WRITE | APR_CREATE,
  @@ -309,21 +309,26 @@
               ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
                            "%s: could not open error log file %s.",
                            ap_server_argv0, fname);
  -            exit(1);
  +            return DONE;
           }
   
           apr_file_inherit_set(s->error_log);
       }
  +
  +    return OK;
   }
   
  -void ap_open_logs(server_rec *s_main, apr_pool_t *p)
  +int ap_open_logs(apr_pool_t *pconf, apr_pool_t *p /* plog */, 
  +                 apr_pool_t *ptemp, server_rec *s_main)
   {
       apr_status_t rc = APR_SUCCESS;
       server_rec *virt, *q;
       int replace_stderr;
       apr_file_t *errfile = NULL;
   
  -    open_error_log(s_main, p);
  +    if (open_error_log(s_main, p) != OK) {
  +        return DONE;
  +    }
   
       replace_stderr = 1;
       if (s_main->error_log) {
  @@ -360,7 +365,9 @@
               }
   
               if (q == virt) {
  -                open_error_log(virt, p);
  +                if (open_error_log(virt, p) != OK) {
  +                    return DONE;
  +                }
               }
               else {
                   virt->error_log = q->error_log;
  @@ -370,6 +377,7 @@
               virt->error_log = s_main->error_log;
           }
       }
  +    return OK;
   }
   
   AP_DECLARE(void) ap_error_log2stderr(server_rec *s) {
  @@ -856,7 +864,7 @@
       if (rc != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
                        "Couldn't start piped log process");
  -        exit (1);
  +        return NULL;
       }
   
       pl = apr_palloc(p, sizeof (*pl));
  
  
  

Mime
View raw message