summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--TODO5
-rw-r--r--doc/ChangeLog4
-rw-r--r--doc/assuan.texi10
-rw-r--r--src/ChangeLog4
-rw-r--r--src/assuan-pipe-connect.c7
-rw-r--r--src/assuan.h1
7 files changed, 27 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index cbd7243..f5d15cc 100644
--- a/NEWS
+++ b/NEWS
@@ -92,6 +92,7 @@ assuan_get_peercred CHANGED: Return assuan_peercred_t.
assuan_client_read_response NEW
assuan_client_parse_response NEW
assuan_fd_from_posix_fd NEW
+ASSUAN_SPAWN_DETACHED NEW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/TODO b/TODO
index b759c14..3efeabd 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,6 @@
-*- outline -*-
* Check that we have Pth-ed all blocking fucntions.
-* When turning libassuan into a shared library, provide a general
- version as well as a Pth-enabled one.
-* Even better, allow replacing all these I/O and spawn functions on
- a per-context basis at runtime (like the old assuan_set_io_hooks but better).
+* Introduce a spawn wrapper program as gpgme has to not leak fds under W32.
* assuan_transact returns immediately on an error in the callback
function. It might be better to return the error to the caller. As
an example see dirmngr-client, where we need to send empty responses
diff --git a/doc/ChangeLog b/doc/ChangeLog
index c647072..1d635ba 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2009-12-08 Marcus Brinkmann <marcus@g10code.de>
+
+ * assuan.texi (Contexts): Document ASSUAN_SPAWN_DETACHED.
+
2009-11-25 Marcus Brinkmann <marcus@g10code.de>
* assuan.texi (Data Types): Document assuan_fdopen.
diff --git a/doc/assuan.texi b/doc/assuan.texi
index 914ffd9..b029d1f 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -913,6 +913,16 @@ case the process should just fork but not call @code{exec}. In this
case, @code{*argv} should be set to @code{"client"} in the parent
process and @code{"server"} in the child process.
+Flags is the bit-wise OR of some (or none) of the following flags:
+
+@table @code
+@item ASSUAN_SPAWN_DETACHED
+If set and there is a need to start the server it will be started as a
+background process. This flag is useful under W32 systems, so that no
+new console is created and pops up a console window when starting the
+server.
+@end table
+
@item pid_t (*waitpid) (assuan_context_t ctx, pid_t pid, int action, int *status, int options)
This is the function called by @sc{Assuan} to wait for the spawned
child process @var{pid} to exit, or, if @var{action} is 1, to just
diff --git a/src/ChangeLog b/src/ChangeLog
index 0636391..d22f869 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2009-12-08 Marcus Brinkmann <marcus@g10code.de>
+ * assuan.h (ASSUAN_SPAWN_DETACHED): New macro.
+ * assuan-pipe-connect.c (pipe_connect): Calculate spawn_flags from
+ flags.
+
* assuan.h (assuan_fd_from_posix_fd): Handle invalid fd early.
* assuan-socket.c (get_nonce): Cast buffer to unsigned.
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index 2b8b264..690d810 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -154,6 +154,7 @@ pipe_connect (assuan_context_t ctx,
pid_t pid;
int res;
struct at_pipe_fork atp;
+ unsigned int spawn_flags;
atp.user_atfork = atfork;
atp.user_atforkvalue = atforkvalue;
@@ -173,10 +174,14 @@ pipe_connect (assuan_context_t ctx,
_assuan_close (ctx, rp[1]);
return _assuan_error (ctx, gpg_err_code_from_syserror ());
}
+
+ spawn_flags = 0;
+ if (flags & ASSUAN_PIPE_CONNECT_DETACHED)
+ spawn_flags |= ASSUAN_SPAWN_DETACHED;
/* FIXME: Use atfork handler that closes child fds on Unix. */
res = _assuan_spawn (ctx, &pid, name, argv, wp[0], rp[1],
- fd_child_list, at_pipe_fork_cb, &atp, flags);
+ fd_child_list, at_pipe_fork_cb, &atp, spawn_flags);
if (res < 0)
{
rc = gpg_err_code_from_syserror ();
diff --git a/src/assuan.h b/src/assuan.h
index 7f78c0c..4886608 100644
--- a/src/assuan.h
+++ b/src/assuan.h
@@ -253,6 +253,7 @@ void assuan_set_io_monitor (assuan_context_t ctx,
#define ASSUAN_SYSTEM_HOOKS_VERSION 1
+#define ASSUAN_SPAWN_DETACHED 128
struct assuan_system_hooks
{
/* Always set to ASSUAN_SYTEM_HOOKS_VERSION. */