summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-03-03 10:02:58 +0100
committerWerner Koch <wk@gnupg.org>2009-03-03 10:02:58 +0100
commitc20b3db108b090b7b34f48a6085a6824fc4db715 (patch)
treecbedc554619505de2750785252791c51a563bce2 /agent
parentAdd missing option strings. (diff)
downloadgnupg2-c20b3db108b090b7b34f48a6085a6824fc4db715.tar.xz
gnupg2-c20b3db108b090b7b34f48a6085a6824fc4db715.zip
Add --reload command to gpgconf.
Fix a problem in exechelp.c Get ready for a release.
Diffstat (limited to 'agent')
-rw-r--r--agent/ChangeLog4
-rw-r--r--agent/agent.h1
-rw-r--r--agent/call-scd.c10
-rw-r--r--agent/command.c6
-rw-r--r--agent/gpg-agent.c2
5 files changed, 21 insertions, 2 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 8ae1ffc2e..9e8bf6133 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,5 +1,9 @@
2009-03-02 Werner Koch <wk@g10code.com>
+ * command.c (cmd_getinfo): Add subcommand "scd_running".
+
+ * call-scd.c (agent_scd_check_running): New.
+
* gpg-agent.c: Add missing option strings for "--batch" and
"--homedir". Reported by Petr Uzel.
diff --git a/agent/agent.h b/agent/agent.h
index 6a66add3f..0e2cc9f40 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -320,6 +320,7 @@ int divert_generic_cmd (ctrl_t ctrl,
/*-- call-scd.c --*/
void initialize_module_call_scd (void);
void agent_scd_dump_state (void);
+int agent_scd_check_running (void);
void agent_scd_check_aliveness (void);
int agent_reset_scd (ctrl_t ctrl);
int agent_card_learn (ctrl_t ctrl,
diff --git a/agent/call-scd.c b/agent/call-scd.c
index c162ad14c..f45e94097 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -409,6 +409,16 @@ start_scd (ctrl_t ctrl)
}
+/* Check whether the SCdaemon is active. This is a fast check without
+ any locking and might give a wrong result if another thread is about
+ to start the daemon or the daemon is about to be stopped.. */
+int
+agent_scd_check_running (void)
+{
+ return !!primary_scd_ctx;
+}
+
+
/* Check whether the Scdaemon is still alive and clean it up if not. */
void
agent_scd_check_aliveness (void)
diff --git a/agent/command.c b/agent/command.c
index b2903f6c9..bf2db1c76 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1396,7 +1396,7 @@ cmd_reloadagent (assuan_context_t ctx, char *line)
pid - Return the process id of the server.
socket_name - Return the name of the socket.
ssh_socket_name - Return the name of the ssh socket.
-
+ scd_running - Return OK if the SCdaemon is already running.
*/
static int
cmd_getinfo (assuan_context_t ctx, char *line)
@@ -1433,6 +1433,10 @@ cmd_getinfo (assuan_context_t ctx, char *line)
else
rc = gpg_error (GPG_ERR_NO_DATA);
}
+ else if (!strcmp (line, "scd_running"))
+ {
+ rc = agent_scd_check_running ()? 0 : gpg_error (GPG_ERR_GENERAL);
+ }
else
rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
return rc;
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 0ab30550c..6cb08409e 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -2022,7 +2022,7 @@ check_own_socket_thread (void *arg)
log_error ("socket is now serviced by another server\n");
rc = 1;
}
- else if (opt.verbose)
+ else if (opt.verbose > 1)
log_error ("socket is still served by this server\n");
xfree (buffer);