From: Christophe Jaillet Date: Sun, 10 Feb 2019 10:14:37 +0000 (+0000) Subject: Follow up to r1847430. X-Git-Tag: 2.5.0-alpha2-ci-test-only~2165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b2ad9f1cd2ea29146a7615128f6f7bd6b79deb;p=thirdparty%2Fapache%2Fhttpd.git Follow up to r1847430. - These flags are not for apr_dir_ function. Clarify comment. - Initialize 'depth', especially when AP_DIR_FLAG_RECURSIVE is explicitelly required. - Avoid an harmless over-allocation . git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1853302 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/httpd.h b/include/httpd.h index eab66b114be..9292c25a7eb 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -2560,7 +2560,7 @@ AP_DECLARE(int) ap_cstr_casecmp(const char *s1, const char *s2); AP_DECLARE(int) ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n); /** - * Default flags for apr_dir_*(). + * Default flags for ap_dir_*fnmatch(). */ #define AP_DIR_FLAG_NONE 0 diff --git a/server/config.c b/server/config.c index dcadba0c665..13bc0922691 100644 --- a/server/config.c +++ b/server/config.c @@ -1920,6 +1920,7 @@ AP_DECLARE(const char *) ap_process_fnmatch_configs(server_rec *s, w.flags = (optional ? AP_DIR_FLAG_OPTIONAL : AP_DIR_FLAG_NONE) | AP_DIR_FLAG_RECURSIVE; w.cb = process_resource_config_cb; w.ctx = &cfgs; + w.depth = 0; /* don't require conf/httpd.conf if we have a -C or -c switch */ if ((ap_server_pre_read_config->nelts diff --git a/server/util.c b/server/util.c index 691846d9065..3693bfbff15 100644 --- a/server/util.c +++ b/server/util.c @@ -3459,13 +3459,13 @@ static int fname_alphasort(const void *fn1, const void *fn2) const fnames *f1 = fn1; const fnames *f2 = fn2; - return strcmp(f1->fname,f2->fname); + return strcmp(f1->fname, f2->fname); } AP_DECLARE(ap_dir_match_t *)ap_dir_cfgmatch(cmd_parms *cmd, int flags, const char *(*cb)(ap_dir_match_t *w, const char *fname), void *ctx) { - ap_dir_match_t *w = apr_palloc(cmd->temp_pool, sizeof(cmd_parms)); + ap_dir_match_t *w = apr_palloc(cmd->temp_pool, sizeof(*w)); w->prefix = apr_pstrcat(cmd->pool, cmd->cmd->name, ": ", NULL); w->p = cmd->pool;