]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Clean up some miscellaneous warnings from Fortify or Intel's compiler
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 7 Oct 2010 16:56:54 +0000 (16:56 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 7 Oct 2010 16:56:54 +0000 (16:56 +0000)
Backports;

 r991516, mod_rewrite.c::cmd_rewritecond(): use enum value instead of
          integer literal
 r991515, util.c::ap_pregsub(): don't needlessly set var
 r991507, scoreboard.c::ap_create_scoreboard(): don't needlessly set var
 r987629+r987631, config.c::ap_build_cont_config(): don't needlessly
                  check var for NULL
 r986901+r987860, core.c::dirsection(): remove dead error check
 r983066, mod_cern_meta.c: remove unexpected ";" after end of block
 r987339, main.c::usage(): don't overlay stack buffer with impossibly
          long argv[0]
 r982050, mpm_unix.c (backported to mpm_common.c): remove unused vars

Author: trawick
Reviewed by: sf, wrowe

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1005523 13f79535-47bb-0310-9956-ffa450edef68

STATUS
modules/mappers/mod_rewrite.c
modules/metadata/mod_cern_meta.c
server/config.c
server/core.c
server/main.c
server/mpm_common.c
server/scoreboard.c
server/util.c

diff --git a/STATUS b/STATUS
index 36adefda2cddf891b5d3a37560d0b01a4adbaaed..53835fca9645f158e107127f746606d3d1fe3d5d 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -113,22 +113,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.2 patch: trunk patch works
      +1: trawick, sf, wrowe
 
-   * clean up some miscellaneous warnings from Fortify or Intel's compiler
-     Trunk revisions:
-       r991516, mod_rewrite.c::cmd_rewritecond(): use enum value instead of 
-         integer literal
-       r991515, util.c::ap_pregsub(): don't needlessly set var
-       r991507, scoreboard.c::ap_create_scoreboard(): don't needlessly set var
-       r987629+r987631, config.c::ap_build_cont_config(): don't needlessly
-         check var for NULL
-       r986901+r987860, core.c::dirsection(): remove dead error check
-       r983066, mod_cern_meta.c: remove unexpected ";" after end of block
-       r987339, main.c::usage(): don't overlay stack buffer with impossibly
-         long argv[0]
-       r982050, mpm_unix.c (backported to mpm_common.c): remove unused vars
-     2.2.x patch: http://people.apache.org/~trawick/fewerwarnings-2.txt
-     +1: trawick, sf, wrowe
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 5b58f5b39da3aa0b1a8ccdf7c60a277347120dfe..36609ccaa947cd20599d0a3ea1f5243818f32607 100644 (file)
@@ -3180,7 +3180,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
     }
 
     /* determine the pattern type */
-    newcond->ptype = 0;
+    newcond->ptype = CONDPAT_REGEX;
     if (*a2 && a2[1]) {
         if (!a2[2] && *a2 == '-') {
             switch (a2[1]) {
index 3b57eef80b999430e0cbe31ade47335fb80be718..b238e2f1db3ef8dfab26678a95f15b06694a0dcb 100644 (file)
@@ -281,18 +281,18 @@ static int add_cern_meta_data(request_rec *r)
 
     if (!dconf->metafiles) {
         return DECLINED;
-    };
+    }
 
     /* if ./.web/$1.meta exists then output 'asis' */
 
     if (r->finfo.filetype == 0) {
         return DECLINED;
-    };
+    }
 
     /* is this a directory? */
     if (r->finfo.filetype == APR_DIR || r->uri[strlen(r->uri) - 1] == '/') {
         return DECLINED;
-    };
+    }
 
     /* what directory is this file in? */
     scrap_book = apr_pstrdup(r->pool, r->filename);
@@ -311,7 +311,7 @@ static int add_cern_meta_data(request_rec *r)
             "internal error in mod_cern_meta: %s", r->filename);
         /* should really barf, but hey, let's be friends... */
         return DECLINED;
-    };
+    }
 
     metafilename = apr_pstrcat(r->pool, scrap_book, "/",
                dconf->metadir ? dconf->metadir : DEFAULT_METADIR,
@@ -345,7 +345,7 @@ static int add_cern_meta_data(request_rec *r)
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
             "meta file permissions deny server access: %s", metafilename);
         return HTTP_FORBIDDEN;
-    };
+    }
 
     /* read the headers in */
     rv = scan_meta_file(r, f);
index 7e5e06b269efecd0e0cd5ef404e723009c568e05..8a742bfbf4c526d6cdf39a8234c4971c1d2f814c 100644 (file)
@@ -1112,11 +1112,11 @@ AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p,
         if (retval != NULL)
             return retval;
 
-        if (sub_tree == NULL && curr_parent != NULL) {
+        if (sub_tree == NULL) {
             sub_tree = *curr_parent;
         }
 
-        if (sub_tree == NULL && current != NULL) {
+        if (sub_tree == NULL) {
             sub_tree = *current;
         }
     }
index 349e8f2cee414a170485cf6caf2b4fd9ba14e77c..76aae1a3be7027f1dbc498258e98078efc74bfab 100644 (file)
@@ -1840,13 +1840,6 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
         return missing_container_arg(cmd);
     }
 
-    if (!arg) {
-        if (thiscmd->cmd_data)
-            return "<DirectoryMatch > block must specify a path";
-        else
-            return "<Directory > block must specify a path";
-    }
-
     cmd->path = ap_getword_conf(cmd->pool, &arg);
     cmd->override = OR_ALL|ACCESS_CONF;
 
index 847849038964b4f22f533a6e260510602a73e068..b893d2814eae7e7371dc8ff0a19f5ade6b614ba7 100644 (file)
@@ -321,14 +321,7 @@ static process_rec *init_process(int *argc, const char * const * *argv)
 static void usage(process_rec *process)
 {
     const char *bin = process->argv[0];
-    char pad[MAX_STRING_LEN];
-    unsigned i;
-
-    for (i = 0; i < strlen(bin); i++) {
-        pad[i] = ' ';
-    }
-
-    pad[i] = '\0';
+    int pad_len = strlen(bin);
 
 #ifdef SHARED_CORE
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL ,
@@ -340,28 +333,28 @@ static void usage(process_rec *process)
 #endif
 
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-C \"directive\"] [-c \"directive\"]", pad);
+                 "       %*s [-C \"directive\"] [-c \"directive\"]", pad_len, " ");
 
 #ifdef WIN32
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-w] [-k start|restart|stop|shutdown]", pad);
+                 "       %*s [-w] [-k start|restart|stop|shutdown]", pad_len, " ");
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-k install|config|uninstall] [-n service_name]",
-                 pad);
+                 "       %*s [-k install|config|uninstall] [-n service_name]",
+                 pad_len, " ");
 #endif
 #ifdef AP_MPM_WANT_SIGNAL_SERVER
 #ifdef AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-k start|restart|graceful|graceful-stop|stop]",
-                 pad);
+                 "       %*s [-k start|restart|graceful|graceful-stop|stop]",
+                 pad_len, " ");
 #else
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-k start|restart|graceful|stop]",
-                 pad);
+                 "       %*s [-k start|restart|graceful|stop]", pad_len, " ");
 #endif /* AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN */
 #endif
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
-                 "       %s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]", pad);
+                 "       %*s [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]",
+                 pad_len, " ");
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                  "Options:");
 
index a95b231213975ccdca9f0d007fdb9bcad1e2cc76..1c50d45be2f36170633ace313c3c1a89c576b789 100644 (file)
@@ -965,7 +965,6 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
     apr_status_t rv;
     pid_t otherpid;
     int running = 0;
-    int have_pid_file = 0;
     const char *status;
 
     *exit_status = 0;
@@ -983,7 +982,6 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
         status = "httpd (no pid file) not running";
     }
     else {
-        have_pid_file = 1;
         if (kill(otherpid, 0) == 0) {
             running = 1;
             status = apr_psprintf(pconf,
@@ -1058,12 +1056,10 @@ void ap_mpm_rewrite_args(process_rec *process)
     apr_getopt_t *opt;
     char optbuf[3];
     const char *optarg;
-    int fixed_args;
 
     mpm_new_argv = apr_array_make(process->pool, process->argc,
                                   sizeof(const char **));
     *(const char **)apr_array_push(mpm_new_argv) = process->argv[0];
-    fixed_args = mpm_new_argv->nelts;
     apr_getopt_init(&opt, process->pool, process->argc, process->argv);
     opt->errfn = NULL;
     optbuf[0] = '-';
index 060de5ca78ade29c688bd6afa22356c6c6953c71..85f375579c79d7c1894cf316d3eace322e775e3c 100644 (file)
@@ -266,14 +266,12 @@ apr_status_t ap_cleanup_scoreboard(void *d)
  */
 int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
 {
-    int running_gen = 0;
     int i;
 #if APR_HAS_SHARED_MEMORY
     apr_status_t rv;
 #endif
 
     if (ap_scoreboard_image) {
-        running_gen = ap_scoreboard_image->global->running_generation;
         ap_scoreboard_image->global->restart_time = apr_time_now();
         memset(ap_scoreboard_image->parent, 0,
                sizeof(process_score) * server_limit);
@@ -315,7 +313,7 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
     }
 
     ap_scoreboard_image->global->sb_type = sb_type;
-    ap_scoreboard_image->global->running_generation = running_gen;
+    ap_scoreboard_image->global->running_generation = 0;
     ap_scoreboard_image->global->restart_time = apr_time_now();
 
     apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null);
index e16b8eb24f1eb93b870c21cbbc728406dfdca567..ac429c788aea166095f687d98154f868494b2206 100644 (file)
@@ -387,7 +387,7 @@ AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
 
         if (no > 9) {                /* Ordinary character. */
             if (c == '\\' && (*src == '$' || *src == '&'))
-                c = *src++;
+                src++;
             len++;
         }
         else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {