]> granicus.if.org Git - apache/commitdiff
* server/log.c (piped_log_spawn): Don't leak an fd for each
authorJoe Orton <jorton@apache.org>
Wed, 18 May 2005 08:03:37 +0000 (08:03 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 18 May 2005 08:03:37 +0000 (08:03 +0000)
invocation.

Reviewed by: Jeff Trawick

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

server/log.c

index b2d4492582601b470855fcb2e0608516e66e16ec..d8f4fd98117ce3d1a6fd82f34485bc9cb9cdc426 100644 (file)
@@ -820,7 +820,11 @@ static apr_status_t piped_log_spawn(piped_log *pl)
 
         if (status == APR_SUCCESS) {
             pl->pid = procnew;
-            ap_piped_log_write_fd(pl) = procnew->in;
+            /* procnew->in was dup2'd from ap_piped_log_write_fd(pl);
+             * since the original fd is still valid, close the copy to
+             * avoid a leak. */
+            apr_file_close(procnew->in);
+            procnew->in = NULL;
             apr_proc_other_child_register(procnew, piped_log_maintenance, pl,
                                           ap_piped_log_write_fd(pl), pl->p);
             close_handle_in_child(pl->p, ap_piped_log_read_fd(pl));