]> granicus.if.org Git - apache/commitdiff
Remove ap_chdir_file. This function is not thread-safe, and nobody
authorRyan Bloom <rbb@apache.org>
Sat, 20 Jan 2001 05:18:06 +0000 (05:18 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 20 Jan 2001 05:18:06 +0000 (05:18 +0000)
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

CHANGES
include/httpd.h
modules/filters/mod_include.c
modules/filters/mod_include.h
server/util.c

diff --git a/CHANGES b/CHANGES
index 08ab175c8db43176d804c4f6b893108181fa756f..74d4447e4fa884f958af803a2f6bde69b1e3f565 100644 (file)
--- 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]
index fcb7503b3d60701a9d2925c4829300a5f52b51da..388a5d360117a0a5a8a2130996b86846ede54e9f 100644 (file)
@@ -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
index 0354a97ba5c7b8d44bf7a6c01eec55ce40a5ad4a..d6be15638265c73c70d47baadb644c1c1cc9f58d 100644 (file)
@@ -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);
 
index efd1c9bcd42ba94d9390071390b2f8dc7c152550..e44fffffe6c71a203390211960c39805d9f484ea 100644 (file)
@@ -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
index f6d389d9ec945c6f1ee3647b0da45b0c4105abfb..3c273ca05794b9547f8a7c1004c7e0741c0aeaf4 100644 (file)
@@ -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);