apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject [PATCH] inheriting pipes
Date Wed, 05 Mar 2003 16:33:28 GMT
Pipes created by the Unix implementation of apr_file_pipe_create are
inherited by default, but you can't make them uninherited without
registering a custom cleanup handler.  Any objections to this patch,
which lets apr_file_inherit_unset work on a pipe for Unix? (it looks
like it might already work on Win32).

Alternatively I wonder whether it would be better to not leak pipes by
default, though presumably it was done this way for a reason...

Index: pipe.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/pipe.c,v
retrieving revision 1.61
diff -u -r1.61 pipe.c
--- pipe.c	7 Jan 2003 00:52:53 -0000	1.61
+++ pipe.c	5 Mar 2003 16:29:11 -0000
@@ -56,6 +56,8 @@
 #include "apr_strings.h"
 #include "apr_portable.h"
 
+#include "apr_arch_inherit.h"
+
 /* Figure out how to get pipe block/nonblock on BeOS...
  * Basically, BONE7 changed things again so that ioctl didn't work,
  * but now fcntl does, hence we need to do this extra checking.
@@ -223,6 +225,8 @@
 #if APR_HAS_THREADS
     (*out)->thlock = NULL;
 #endif
+
+    (*in)->flags = (*out)->flags = APR_INHERIT;
 
     apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
                          apr_pool_cleanup_null);

Mime
View raw message