Commit db9deecf authored by Ryan Bloom's avatar Ryan Bloom
Browse files

Remove ap_chdir_file. This function is not thread-safe, and nobody

is currently using it.  The proper way to do this, is to use the
apr_create_process API.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87754 13f79535-47bb-0310-9956-ffa450edef68
parent 8b00d096
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
Changes with Apache 2.0b1

  *) Remove ap_chdir_file().  This function is not thread-safe,
     and nobody is currently using it.  [Ryan Bloom]

  *) Do not try to run make depend if there are no .c files in the
     current directory, doing so makes `make depend` fail.
     [Ryan Bloom]
+0 −6
Original line number Diff line number Diff line
@@ -1535,12 +1535,6 @@ AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name);
 * @deffunc int ap_is_directory(apr_pool_t *p, 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
 * @deffunc void ap_chdir_file(const char *file)
 */
AP_DECLARE(void) ap_chdir_file(const char *file);
/**
 * Get the maximum number of daemons processes for this version of Apache
 * @return The maximum number of daemon processes
+0 −5
Original line number Diff line number Diff line
@@ -752,7 +752,6 @@ static int include_cgi(char *s, request_rec *r, ap_filter_t *next,
    }

    ap_destroy_sub_req(rr);
    ap_chdir_file(r->filename);

    return 0;
}
@@ -901,7 +900,6 @@ static int handle_include(include_ctx_t *ctx, apr_bucket_brigade **bb, request_r
                        error_fmt = "unable to include \"%s\" in parsed file %s";
                    }
                }
                ap_chdir_file(r->filename);
                if (error_fmt) {
                    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
    			    0, r, error_fmt, tag_val, r->filename);
@@ -1113,7 +1111,6 @@ static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec
                        CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head);
                    }
                    /* just in case some stooge changed directories */
                    ap_chdir_file(r->filename);
                }
                else if (!strcmp(tag, "cgi")) {
                    parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0);
@@ -1123,7 +1120,6 @@ static int handle_exec(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec
                                    "invalid CGI ref \"%s\" in %s", tag_val, file);
                        CREATE_ERROR_BUCKET(ctx, tmp_buck, head_ptr, *inserted_head);
                    }
                    ap_chdir_file(r->filename);
                }
                else {
                    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
@@ -2615,7 +2611,6 @@ static void send_parsed_content(apr_bucket_brigade **bb, request_rec *r,
    apr_bucket_brigade *tag_and_after;
    int ret;

    ap_chdir_file(r->filename);
    if (r->args) {              /* add QUERY stuff to env cause it ain't yet */
        char *arg_copy = apr_pstrdup(r->pool, r->args);

+0 −4
Original line number Diff line number Diff line
@@ -80,10 +80,6 @@ module AP_MODULE_DECLARE_DATA includes_module;
/* just need some arbitrary non-NULL pointer which can't also be a request_rec */
#define NESTED_INCLUDE_MAGIC	(&includes_module)

/* TODO: changing directory should be handled by CreateProcess */
#define ap_chdir_file(x) do {} while(0)


/****************************************************************************
 * Used to keep context information during parsing of a request for SSI tags.
 * This is especially useful if the tag stretches across multiple buckets or
+0 −19
Original line number Diff line number Diff line
@@ -630,25 +630,6 @@ AP_DECLARE(int) ap_count_dirs(const char *path)
    return n;
}


AP_DECLARE(void) ap_chdir_file(const char *file)
{
    const char *x;
    char buf[HUGE_STRING_LEN];

    x = ap_strrchr_c(file, '/');
    if (x == NULL) {
	chdir(file);
    }
    else if (x - file < sizeof(buf) - 1) {
	memcpy(buf, file, x - file);
	buf[x - file] = '\0';
	chdir(buf);
    }
    /* XXX: well, this is a silly function, no method of reporting an
     * error... ah well. */
}

AP_DECLARE(char *) ap_getword_nc(apr_pool_t *atrans, char **line, char stop)
{
    return ap_getword(atrans, (const char **) line, stop);