summaryrefslogtreecommitdiffstats
path: root/server/core.c
diff options
context:
space:
mode:
authorChristophe Jaillet <jailletc36@apache.org>2019-09-04 21:11:28 +0200
committerChristophe Jaillet <jailletc36@apache.org>2019-09-04 21:11:28 +0200
commite1f29d826efb7941c8b59f5adae5b7111635c82f (patch)
tree083761ae568233d4e958d150a603ea04ce309b11 /server/core.c
parentPR63715: s/can/came and add a caution about REDIRECT_-prefixed envvars (diff)
downloadapache2-e1f29d826efb7941c8b59f5adae5b7111635c82f.tar.xz
apache2-e1f29d826efb7941c8b59f5adae5b7111635c82f.zip
Fix an issue on Windows where <IfFile> looks for a file on a non-existent drive (on a USB key that is not plugged for example)
Issue repported by Heather Lotz <knot22 hotmail.com> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1866418 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/core.c')
-rw-r--r--server/core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/core.c b/server/core.c
index 11bf8d3d10..6de5892a21 100644
--- a/server/core.c
+++ b/server/core.c
@@ -2948,8 +2948,15 @@ static int test_iffile_section(cmd_parms *cmd, const char *arg)
const char *relative;
apr_finfo_t sb;
+ /*
+ * At least on Windows, if the path we are testing is not valid (for example
+ * a path on a USB key that is not plugged), 'ap_server_root_relative()' will
+ * return NULL. In such a case, consider that the file is not there and that
+ * the section should be skipped.
+ */
relative = ap_server_root_relative(cmd->temp_pool, arg);
- return (apr_stat(&sb, relative, 0, cmd->pool) == APR_SUCCESS);
+ return (relative &&
+ (apr_stat(&sb, relative, APR_FINFO_TYPE, cmd->temp_pool) == APR_SUCCESS));
}
static int test_ifdirective_section(cmd_parms *cmd, const char *arg)