On Sat, 2007-04-28 at 09:02 +1000, Bojan Smojver wrote:

> I guess 41119 will be left the way it is? Should we just document and
> close?

Here is that hackish patch (also attached to the bug report).

What's the final verdict on this behaviour? Document and close? Or
patch?

-- 
Bojan
Index: memory/unix/apr_pools.c
===================================================================
--- memory/unix/apr_pools.c	(revision 537103)
+++ memory/unix/apr_pools.c	(working copy)
@@ -2100,6 +2100,13 @@
         cleanup_pool_for_exec(p);
 }
 
+static int cleanup_for_exec = 0;
+
+APR_DECLARE(int) apr_cleanup_is_for_exec()
+{
+    return cleanup_for_exec;
+}
+
 APR_DECLARE(void) apr_pool_cleanup_for_exec(void)
 {
 #if !defined(WIN32) && !defined(OS2)
@@ -2112,7 +2119,9 @@
      * I can do about that (except if the child decides
      * to go out and close them
      */
+    cleanup_for_exec = 1;
     cleanup_pool_for_exec(global_pool);
+    cleanup_for_exec = 0;
 #endif /* !defined(WIN32) && !defined(OS2) */
 }
 
Index: include/arch/apr_private_common.h
===================================================================
--- include/arch/apr_private_common.h	(revision 537103)
+++ include/arch/apr_private_common.h	(working copy)
@@ -39,4 +39,7 @@
 #define APR_UINT32_TRUNC_CAST apr_uint32_t
 #define APR_UINT32_MAX        0xFFFFFFFFUL
 
+/* cleanup_for_exec */
+int apr_cleanup_is_for_exec();
+
 #endif  /*APR_PRIVATE_COMMON_H*/
Index: file_io/win32/readwrite.c
===================================================================
--- file_io/win32/readwrite.c	(revision 537103)
+++ file_io/win32/readwrite.c	(working copy)
@@ -467,6 +467,10 @@
 
 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
 {
+    if (apr_cleanup_is_for_exec()) {
+        return APR_SUCCESS;
+    }
+
     if (thefile->buffered) {
         DWORD numbytes, written = 0;
         apr_status_t rc = 0;
Index: file_io/os2/readwrite.c
===================================================================
--- file_io/os2/readwrite.c	(revision 537103)
+++ file_io/os2/readwrite.c	(working copy)
@@ -283,6 +283,10 @@
 
 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
 {
+    if (apr_cleanup_is_for_exec()) {
+        return APR_SUCCESS;
+    }
+
     if (thefile->buffered) {
         ULONG written = 0;
         int rc = 0;
Index: file_io/unix/readwrite.c
===================================================================
--- file_io/unix/readwrite.c	(revision 537103)
+++ file_io/unix/readwrite.c	(working copy)
@@ -319,6 +319,10 @@
 
 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
 {
+    if (apr_cleanup_is_for_exec()) {
+        return APR_SUCCESS;
+    }
+
     if (thefile->buffered) {
         if (thefile->direction == 1 && thefile->bufpos) {
             apr_ssize_t written;

Reply via email to