rse         98/05/29 01:32:41

  Modified:    src      CHANGES
               src/modules/standard mod_rewrite.c mod_rewrite.h
  Log:
  Change usage of perror()+fprintf(stderr,...) in mod_rewrite to more proper
  ap_log_error() variants. Same Brian has done for the other modules, BTW.
  
  Revision  Changes    Path
  1.876     +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.875
  retrieving revision 1.876
  diff -u -r1.875 -r1.876
  --- CHANGES   1998/05/29 07:59:55     1.875
  +++ CHANGES   1998/05/29 08:32:36     1.876
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3b8
   
  +  *) Change usage of perror()+fprintf(stderr,...) in mod_rewrite to
  +     more proper ap_log_error() variants.
  +     [Ralf S. Engelschall]
  +
     *) Make sure the argument for the --add-module option to APACI's configure
        script is of type [path/to/]mod_xxx.c because all calculations inside
        configure and src/Configure depend on this.
  
  
  
  1.112     +25 -43    apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- mod_rewrite.c     1998/05/29 06:59:35     1.111
  +++ mod_rewrite.c     1998/05/29 08:32:39     1.112
  @@ -2892,10 +2892,9 @@
   
       if (*conf->rewritelogfile == '|') {
           if ((pl = ap_open_piped_log(p, conf->rewritelogfile+1)) == NULL) {
  -            perror("ap_open_piped_log");
  -            fprintf(stderr,
  -                    "mod_rewrite: could not open reliable piped log for "
  -                    "RewriteLog\n");
  +            ap_log_error(APLOG_MARK, APLOG_ERR, s, 
  +                         "mod_rewrite: could not open reliable pipe "
  +                         "to RewriteLog filter %s", conf->rewritelogfile+1);
               exit(1);
           }
           conf->rewritelogfp = ap_piped_log_write_fd(pl);
  @@ -2903,10 +2902,9 @@
       else if (*conf->rewritelogfile != '\0') {
           if ((conf->rewritelogfp = ap_popenf(p, fname, rewritelog_flags,
                                            rewritelog_mode)) < 0) {
  -            perror("open");
  -            fprintf(stderr,
  -                    "mod_rewrite: could not open RewriteLog file %s.\n",
  -                    fname);
  +            ap_log_error(APLOG_MARK, APLOG_ERR, s, 
  +                         "mod_rewrite: could not open RewriteLog "
  +                         "file %s", fname);
               exit(1);
           }
       }
  @@ -2980,9 +2978,9 @@
                   (unsigned long)(r->server), (unsigned long)r,
                   type, redir, level, str2);
   
  -    fd_lock(conf->rewritelogfp);
  +    fd_lock(r, conf->rewritelogfp);
       write(conf->rewritelogfp, str3, strlen(str3));
  -    fd_unlock(conf->rewritelogfp);
  +    fd_unlock(r, conf->rewritelogfp);
   
       va_end(ap);
       return;
  @@ -3042,9 +3040,9 @@
       if ((conf->rewritelockfp = ap_popenf(p, conf->rewritelockfile,
                                         O_WRONLY|O_CREAT,
                                         REWRITELOCK_MODE)) < 0) {
  -        perror("open");
  -        fprintf(stderr, "mod_rewrite: Parent could not create RewriteLock"
  -                " file %s.\n", conf->rewritelockfile);
  +        ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +                     "mod_rewrite: Parent could not create RewriteLock "
  +                     "file %s", conf->rewritelockfile);
           exit(1);
       }
       return;
  @@ -3065,9 +3063,9 @@
       if ((conf->rewritelockfp = ap_popenf(p, conf->rewritelockfile,
                                         O_WRONLY,
                                         REWRITELOCK_MODE)) < 0) {
  -        perror("open");
  -        fprintf(stderr, "mod_rewrite: Child could not open RewriteLock"
  -                " file %s.\n", conf->rewritelockfile);
  +        ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +                     "mod_rewrite: Child could not open RewriteLock "
  +                     "file %s", conf->rewritelockfile);
           exit(1);
       }
       return;
  @@ -3098,7 +3096,7 @@
       conf = ap_get_module_config(r->server->module_config, &rewrite_module);
   
       if (conf->rewritelockfp != -1)
  -        fd_lock(conf->rewritelockfp);
  +        fd_lock(r, conf->rewritelockfp);
       return;
   }
   
  @@ -3109,7 +3107,7 @@
       conf = ap_get_module_config(r->server->module_config, &rewrite_module);
   
       if (conf->rewritelockfp != -1)
  -        fd_unlock(conf->rewritelockfp);
  +        fd_unlock(r, conf->rewritelockfp);
       return;
   }
   
  @@ -3159,9 +3157,9 @@
                               (void *)map->datafile, kill_after_timeout,
                               &fpin, &fpout, &fperr);
           if (rc == 0 || fpin == NULL || fpout == NULL) {
  -            perror("ap_spawn_child");
  -            fprintf(stderr, "mod_rewrite: "
  -                    "could not fork child for RewriteMap process\n");
  +            ap_log_error(APLOG_MARK, APLOG_ERR, s,
  +                         "mod_rewrite: could not fork child for "
  +                         "RewriteMap process");
               exit(1);
           }
           map->fpin  = fileno(fpin);
  @@ -3846,7 +3844,7 @@
   static struct flock unlock_it;
   #endif
   
  -static void fd_lock(int fd)
  +static void fd_lock(request_rec *r, int fd)
   {
       int rc;
   
  @@ -3875,22 +3873,14 @@
   #endif
   
       if (rc < 0) {
  -#ifdef USE_FLOCK
  -        perror("flock");
  -#endif
  -#ifdef USE_FCNTL
  -        perror("fcntl");
  -#endif
  -#ifdef USE_LOCKING
  -        perror("_locking");
  -#endif
  -        fprintf(stderr, "mod_rewrite: Error getting lock. Exiting!");
  +        ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "mod_rewrite: failed to lock file descriptor");
           exit(1);
       }
       return;
   }
   
  -static void fd_unlock(int fd)
  +static void fd_unlock(request_rec *r, int fd)
   {
       int rc;
   
  @@ -3913,16 +3903,8 @@
   #endif
   
       if (rc < 0) {
  -#ifdef USE_FLOCK
  -        perror("flock");
  -#endif
  -#ifdef USE_FCNTL
  -        perror("fcntl");
  -#endif
  -#ifdef USE_LOCKING
  -        perror("_locking");
  -#endif
  -        fprintf(stderr, "mod_rewrite: Error freeing lock. Exiting!");
  +        ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "mod_rewrite: failed to unlock file descriptor");
           exit(1);
       }
   }
  
  
  
  1.53      +2 -2      apache-1.3/src/modules/standard/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- mod_rewrite.h     1998/05/28 11:09:46     1.52
  +++ mod_rewrite.h     1998/05/29 08:32:40     1.53
  @@ -463,8 +463,8 @@
   static void   add_env_variable(request_rec *r, char *s);
   
       /* File locking */
  -static void fd_lock(int fd);
  -static void fd_unlock(int fd);
  +static void fd_lock(request_rec *r, int fd);
  +static void fd_unlock(request_rec *r, int fd);
   
       /* Lexicographic Comparison */
   static int compare_lexicography(char *cpNum1, char *cpNum2);
  
  
  

Reply via email to