diff options
author | Werner Koch <[email protected]> | 2004-01-24 20:46:28 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2004-01-24 20:46:28 +0000 |
commit | b208c86a6a3f24264e34151ab1c981f3b22ef89f (patch) | |
tree | 65e811b50b54038692b971087866b1dd1c73ede7 /src/assuan-pipe-connect.c | |
parent | (_assuan_cookie_write_data): Return the (diff) | |
download | libassuan-b208c86a6a3f24264e34151ab1c981f3b22ef89f.tar.gz libassuan-b208c86a6a3f24264e34151ab1c981f3b22ef89f.zip |
(assuan_pipe_connect2): New as an
extension of assuan_pipe_connect. Made the latter call this one.
Diffstat (limited to 'src/assuan-pipe-connect.c')
-rw-r--r-- | src/assuan-pipe-connect.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c index d30c106..9c41aa9 100644 --- a/src/assuan-pipe-connect.c +++ b/src/assuan-pipe-connect.c @@ -97,10 +97,15 @@ do_deinit (ASSUAN_CONTEXT ctx) /* 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. FD_CHILD_LIST is a -1 terminated list of file - descriptors not to close in the child. */ + descriptors not to close in the child. ATFORK is called in the + child right after the fork; ATFORKVALUE is passed as the first + argument and 0 is passed as the second argument. The ATFORK + function should only act if the second value is 0. */ AssuanError -assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[], - int *fd_child_list) +assuan_pipe_connect2 (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[], + int *fd_child_list, + void (*atfork) (void *opaque, int reserved), + void *atforkvalue) { static int fixed_signals = 0; AssuanError err; @@ -168,6 +173,9 @@ assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[], char errbuf[512]; int *fdp; + if (atfork) + atfork (atforkvalue, 0); + /* Dup handles to stdin/stdout. */ if (rp[1] != STDOUT_FILENO) { @@ -267,15 +275,13 @@ assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[], } - - - - - - - - - - - - +/* 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. 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[], + int *fd_child_list) +{ + return assuan_pipe_connect2 (ctx, name, argv, fd_child_list, NULL, NULL); +} |