httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Mon, 28 Jul 2003 14:53:33 GMT
nd          2003/07/28 07:53:33

  Modified:    modules/mappers mod_rewrite.c
  Log:
  exit(1) should never occur in any module. Stay away from it.
  
  Revision  Changes    Path
  1.191     +17 -15    httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.190
  retrieving revision 1.191
  diff -u -r1.190 -r1.191
  --- mod_rewrite.c	28 Jul 2003 14:18:45 -0000	1.190
  +++ mod_rewrite.c	28 Jul 2003 14:53:32 -0000	1.191
  @@ -381,7 +381,7 @@
       return apr_pstrdup(r->pool, tstr);
   }
   
  -static void open_rewritelog(server_rec *s, apr_pool_t *p)
  +static int open_rewritelog(server_rec *s, apr_pool_t *p)
   {
       rewrite_server_conf *conf;
       const char *fname;
  @@ -390,14 +390,12 @@
   
       conf = ap_get_module_config(s->module_config, &rewrite_module);
   
  -    if (conf->rewritelogfile == NULL) {
  -        return;
  -    }
  -    if (*(conf->rewritelogfile) == '\0') {
  -        return;
  -    }
  -    if (conf->rewritelogfp != NULL) {
  -        return; /* virtual log shared w/ main server */
  +    /* - no logfile configured
  +     * - logfilename empty
  +     * - virtual log shared w/ main server
  +     */
  +    if (!conf->rewritelogfile || !*conf->rewritelogfile || conf->rewritelogfp)
{
  +        return 1;
       }
   
       if (*conf->rewritelogfile == '|') {
  @@ -405,17 +403,17 @@
               ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
                            "mod_rewrite: could not open reliable pipe "
                            "to RewriteLog filter %s", conf->rewritelogfile+1);
  -            exit(1);
  +            return 0;
           }
           conf->rewritelogfp = ap_piped_log_write_fd(pl);
       }
  -    else if (*conf->rewritelogfile != '\0') {
  +    else {
           fname = ap_server_root_relative(p, conf->rewritelogfile);
           if (!fname) {
               ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
                            "mod_rewrite: Invalid RewriteLog "
                            "path %s", conf->rewritelogfile);
  -            exit(1);
  +            return 0;
           }
           if ((rc = apr_file_open(&conf->rewritelogfp, fname,
                                   REWRITELOG_FLAGS, REWRITELOG_MODE, p))
  @@ -423,10 +421,11 @@
               ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
                            "mod_rewrite: could not open RewriteLog "
                            "file %s", fname);
  -            exit(1);
  +            return 0;
           }
       }
  -    return;
  +
  +    return 1;
   }
   
   static void rewritelog(request_rec *r, int level, const char *text, ...)
  @@ -3787,7 +3786,10 @@
        * - open the RewriteMap prg:xxx programs
        */
       for (; s; s = s->next) {
  -        open_rewritelog(s, p);
  +        if (!open_rewritelog(s, p)) {
  +            return HTTP_INTERNAL_SERVER_ERROR;
  +        }
  +
           if (!first_time) {
               if (run_rewritemap_programs(s, p) != APR_SUCCESS) {
                   return HTTP_INTERNAL_SERVER_ERROR;
  
  
  

Mime
View raw message