aboutsummaryrefslogtreecommitdiffstats
path: root/assuan/assuan-connect.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assuan/assuan-connect.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/assuan/assuan-connect.c b/assuan/assuan-connect.c
index 683c7f060..613b54a13 100644
--- a/assuan/assuan-connect.c
+++ b/assuan/assuan-connect.c
@@ -71,9 +71,11 @@ writen ( int fd, const char *buffer, size_t length )
/* Connect to a server over a pipe, creating the assuan context and
returning it in CTX. The server filename is NAME, the argument
- vector in ARGV. */
+ vector in ARGV. FD_CHILD_LIST is a -1 terminated list of file
+ descriptors not to close in the child. */
AssuanError
-assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[])
+assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[],
+ int *fd_child_list)
{
static int fixed_signals = 0;
AssuanError err;
@@ -149,7 +151,16 @@ assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[])
n = MAX_OPEN_FDS;
for (i=0; i < n; i++)
{
- if (i != fileno (stderr)
+ int *fdp = fd_child_list;
+
+ if (fdp)
+ {
+ while (*fdp != -1 && *fdp != i)
+ fdp++;
+ }
+
+ if (!(fdp && *fdp != -1)
+ && i != fileno (stderr)
#ifdef HAVE_JNLIB_LOGGING
&& i != log_fd
#endif