From: Ryan Bloom Date: Sat, 20 Jan 2001 05:18:06 +0000 (+0000) Subject: Remove ap_chdir_file. This function is not thread-safe, and nobody X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db9deecf9440c7c800210ead3e67614abc992ab4;p=apache 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 --- diff --git a/CHANGES b/CHANGES index 08ab175c8d..74d4447e4f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ 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] diff --git a/include/httpd.h b/include/httpd.h index fcb7503b3d..388a5d3601 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -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 diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 0354a97ba5..d6be156382 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -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); diff --git a/modules/filters/mod_include.h b/modules/filters/mod_include.h index efd1c9bcd4..e44fffffe6 100644 --- a/modules/filters/mod_include.h +++ b/modules/filters/mod_include.h @@ -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 diff --git a/server/util.c b/server/util.c index f6d389d9ec..3c273ca057 100644 --- a/server/util.c +++ b/server/util.c @@ -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);