]> granicus.if.org Git - apache/commitdiff
Fix a problem in mod_mime_magic where file descriptor 2 would be
authorJeff Trawick <trawick@apache.org>
Mon, 19 Mar 2001 16:07:59 +0000 (16:07 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 19 Mar 2001 16:07:59 +0000 (16:07 +0000)
inadvertently closed.  This logic was in the uncompress child in 1.3
but was in the parent in 2.0.

uncompress_child() was renamed to create_uncompress_child() to reflect
a change in use since 1.3.

A note was added about missing 1.3 logic for doing something with the
stderr of the uncompress process.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88538 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/metadata/mod_mime_magic.c

diff --git a/CHANGES b/CHANGES
index b5b14d91c79218ddbb1b12b9ab25a02f490c3441..eb9a0dbe74dea8aa43f49c006147c97f5a2e75ad 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.15-dev
 
+  *) Get rid of an inadvertent close of file descriptor 2 in
+     mod_mime_magic.  [Greg Ames, Jeff Trawick]
+
   *) Add a hook, create_request.  This hook allows modules to modify
      a request while it is being created.  This hook is called for all
      request_rec's, main request, sub request, and internal redirect.
index 81b8ebce2c8a3ba1d2b919dfa34512274410e11a..36aa086918e0b8c09440466c9f95824699eb78af 100644 (file)
@@ -2147,8 +2147,8 @@ struct uncompress_parms {
     int method;
 };
 
-static int uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,
-                            apr_file_t **pipe_in)
+static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,
+                                   apr_file_t **pipe_in)
 {
     int rc = 1;
     const char *new_argv[4];
@@ -2158,6 +2158,12 @@ static int uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,
     apr_procattr_t *procattr;
     apr_proc_t *procnew;
 
+    /* XXX missing 1.3 logic: 
+     *
+     * what happens when !compr[parm->method].silent?
+     * Should we create the err pipe, read it, and copy to the log?
+     */
+        
     env = (const char *const *)ap_create_environment(child_context, r->subprocess_env);
 
     if ((apr_procattr_create(&procattr, child_context) != APR_SUCCESS) ||
@@ -2175,10 +2181,6 @@ static int uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,
         new_argv[2] = r->filename;
         new_argv[3] = NULL;
 
-        if (compr[parm->method].silent) {
-            close(STDERR_FILENO);
-        }
-
         procnew = apr_pcalloc(child_context, sizeof(*procnew));
         rc = apr_proc_create(procnew, compr[parm->method].argv[0],
                                new_argv, env, procattr, child_context);
@@ -2216,7 +2218,7 @@ static int uncompress(request_rec *r, int method,
     if (apr_pool_create(&sub_context, r->pool) != APR_SUCCESS)
         return -1;
 
-    if ((rv = uncompress_child(&parm, sub_context, &pipe_out)) != APR_SUCCESS) {
+    if ((rv = create_uncompress_child(&parm, sub_context, &pipe_out)) != APR_SUCCESS) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                    MODNAME ": couldn't spawn uncompress process: %s", r->uri);
        return -1;