From 0be01064052334110dc8c3e6bfaaa95d7d051a1c Mon Sep 17 00:00:00 2001 From: "Allan K. Edwards" Date: Fri, 5 Jan 2001 20:44:44 +0000 Subject: [PATCH] add pool parameter to ap_is_directory and ap_is_rdirectory git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87593 13f79535-47bb-0310-9956-ffa450edef68 --- include/httpd.h | 10 ++++++---- modules/http/http_core.c | 4 ++-- server/config.c | 2 +- server/util.c | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/httpd.h b/include/httpd.h index 6b4a3791ad..fcb7503b3d 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1521,18 +1521,20 @@ AP_DECLARE(uid_t) ap_uname2id(const char *name); AP_DECLARE(gid_t) ap_gname2id(const char *name); /** * Given the name of an object in the file system determine if it is a directory + * @param p The pool to allocate out of * @param name The name of the object to check * @return 1 if it is a directory, 0 otherwise - * @deffunc int ap_is_rdirectory(const char *name) + * @deffunc int ap_is_rdirectory(apr_pool_t *p, const char *name) */ -AP_DECLARE(int) ap_is_rdirectory(const char *name); +AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name); /** * Given the name of an object in the file system determine if it is a directory - this version is symlink aware + * @param p The pool to allocate out of * @param name The name of the object to check * @return 1 if it is a directory, 0 otherwise - * @deffunc int ap_is_directory(const char *name) + * @deffunc int ap_is_directory(apr_pool_t *p, const char *name) */ -AP_DECLARE(int) ap_is_directory(const char *name); +AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name); /** * Given a pathname in file, extract the directory and chdir to that directory * @param file The file who's directory we wish to switch to diff --git a/modules/http/http_core.c b/modules/http/http_core.c index c788bc7a3a..be30d82f73 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -1193,7 +1193,7 @@ static const char *set_document_root(cmd_parms *cmd, void *dummy, } arg = ap_os_canonical_filename(cmd->pool, arg); - if (/* TODO: ap_configtestonly && ap_docrootcheck && */ !ap_is_directory(arg)) { + if (/* TODO: ap_configtestonly && ap_docrootcheck && */ !ap_is_directory(cmd->pool, arg)) { if (cmd->server->is_virtual) { ap_log_perror(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, cmd->pool, "Warning: DocumentRoot [%s] does not exist", @@ -1994,7 +1994,7 @@ static const char *set_server_root(cmd_parms *cmd, void *dummy, arg = ap_os_canonical_filename(cmd->pool, arg); - if (!ap_is_directory(arg)) { + if (!ap_is_directory(cmd->pool, arg)) { return "ServerRoot must be a valid directory"; } ap_server_root = arg; diff --git a/server/config.c b/server/config.c index ef96572033..c1dfb9061a 100644 --- a/server/config.c +++ b/server/config.c @@ -1369,7 +1369,7 @@ void ap_process_resource_config(server_rec *s, const char *fname, * horrible loops). If so, let's recurse and toss it back into * the function. */ - if (ap_is_rdirectory(fname)) { + if (ap_is_rdirectory(ptemp, fname)) { apr_dir_t *dirp; int current; apr_array_header_t *candidates = NULL; diff --git a/server/util.c b/server/util.c index d0a8056c9d..10d6b81fc8 100644 --- a/server/util.c +++ b/server/util.c @@ -1694,21 +1694,21 @@ AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s) return x; } -AP_DECLARE(int) ap_is_directory(const char *path) +AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path) { apr_finfo_t finfo; - if (apr_stat(&finfo, path, NULL) == -1) + if (apr_stat(&finfo, path, p) == -1) return 0; /* in error condition, just return no */ return (finfo.filetype == APR_DIR); } -AP_DECLARE(int) ap_is_rdirectory(const char *path) +AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *path) { apr_finfo_t finfo; - if (apr_lstat(&finfo, path, NULL) == -1) + if (apr_lstat(&finfo, path, p) == -1) return 0; /* in error condition, just return no */ return (finfo.filetype == APR_DIR); -- 2.50.1