[Pkg-gnupg-commit] [libassuan] 98/437: (assuan_pipe_connect2): New as an extension of assuan_pipe_connect. Made the latter call this one.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:33:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit b208c86a6a3f24264e34151ab1c981f3b22ef89f
Author: Werner Koch <wk at gnupg.org>
Date:   Sat Jan 24 20:46:28 2004 +0000

    (assuan_pipe_connect2): New as an
    extension of assuan_pipe_connect. Made the latter call this one.
---
 NEWS                      |  3 +++
 src/ChangeLog             |  5 +++++
 src/assuan-pipe-connect.c | 36 +++++++++++++++++++++---------------
 src/assuan.h              |  6 +++++-
 4 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/NEWS b/NEWS
index 550ca2b..26ba0ab 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ Noteworthy changes in version 0.6.3 (unreleased)
 
  * Fixed a data corruption bug in assuan_get_data_fp.
 
+ * New function assuan_pipe_connect2.
+
+
 Noteworthy changes in version 0.6.2 (2003-12-18)
 ------------------------------------------------
 
diff --git a/src/ChangeLog b/src/ChangeLog
index e31da5c..a5c58f4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-24  Werner Koch  <wk at gnupg.org>
+
+	* assuan-pipe-connect.c (assuan_pipe_connect2): New as an
+	extension of assuan_pipe_connect. Made the latter call this one.
+
 2004-01-14  Werner Koch  <wk at gnupg.org>
 
 	* assuan-buffer.c (_assuan_cookie_write_data): Return the
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);
+}
diff --git a/src/assuan.h b/src/assuan.h
index 3da9b31..2b5637e 100644
--- a/src/assuan.h
+++ b/src/assuan.h
@@ -198,9 +198,13 @@ int assuan_init_connected_socket_server (assuan_context_t *r_ctx, int fd);
 /*-- assuan-pipe-connect.c --*/
 assuan_error_t assuan_pipe_connect (assuan_context_t *ctx, const char *name,
                                  char *const argv[], int *fd_child_list);
+assuan_error_t assuan_pipe_connect2 (assuan_context_t *ctx, const char *name,
+                                     char *const argv[], int *fd_child_list,
+                                     void (*atfork) (void*, int),
+                                     void *atforkvalue);
 /*-- assuan-socket-connect.c --*/
 assuan_error_t assuan_socket_connect (assuan_context_t *ctx, const char *name,
-                                   pid_t server_pid);
+                                      pid_t server_pid);
 
 /*-- assuan-domain-connect.c --*/
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list