Commit f32c623a authored by Allan K. Edwards's avatar Allan K. Edwards
Browse files

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
parent ad0316ef
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;
+4 −4
Original line number Diff line number Diff line
@@ -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);