summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-11-15 13:47:48 +0100
committerWerner Koch <wk@gnupg.org>2017-11-15 13:48:28 +0100
commit4a7fe9a596b639a0edb08502f20cb293129e5a33 (patch)
tree1326c0f6da211d49ed1453a55299593dc31fc707 /common
parentMerge T3490-proposal1 into master (diff)
downloadgnupg2-4a7fe9a596b639a0edb08502f20cb293129e5a33.tar.xz
gnupg2-4a7fe9a596b639a0edb08502f20cb293129e5a33.zip
common: Tweak new code to keep already translated strings.
* common/asshelp.c (wait_for_sock): Replace NAME by WHICH and adjust caller. Revert to use the former strings. -- Note that the second of these strings "waiting for the agent to come up ... (%ds)\n" "connection to agent established\n" does not use a proper article. This should be fixed but would introduce a string change so that it is better done in a separate commit. Fixes-commit: 0471ff9d3bf8d6b9a359f3c426d70d0935066907 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common')
-rw-r--r--common/asshelp.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/common/asshelp.c b/common/asshelp.c
index 76f812d8c..7f5173d7f 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -307,8 +307,19 @@ unlock_spawning (lock_spawn_t *lock, const char *name)
}
}
+
+/* Helper for start_new_gpg_agent and start_new_dirmngr.
+ * Values for WHICH are:
+ * 0 - Start gpg-agent
+ * 1 - Start dirmngr
+ * SECS give the number of seconds to wait. SOCKNAME is the name of
+ * the socket to connect. VERBOSE is the usual verbose flag. CTX is
+ * the assuan context. DID_SUCCESS_MSG will be set to 1 if a success
+ * messages has been printed.
+ */
static gpg_error_t
-wait_for_sock (int secs, const char *name, const char *sockname, int verbose, assuan_context_t ctx, int *did_success_msg)
+wait_for_sock (int secs, int which, const char *sockname,
+ int verbose, assuan_context_t ctx, int *did_success_msg)
{
gpg_error_t err = 0;
int target_us = secs * 1000000;
@@ -329,8 +340,10 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as
secsleft = (target_us - elapsed_us)/1000000;
if (secsleft < lastalert)
{
- log_info (_("waiting for the %s to come up ... (%ds)\n"),
- name, secsleft);
+ log_info (which == 1?
+ _("waiting for the dirmngr to come up ... (%ds)\n"):
+ _("waiting for the agent to come up ... (%ds)\n"),
+ secsleft);
lastalert = secsleft;
}
}
@@ -341,8 +354,9 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as
{
if (verbose)
{
- log_info (_("connection to %s established\n"),
- name);
+ log_info (which == 1?
+ _("connection to the dirmngr established\n"):
+ _("connection to agent established\n"));
*did_success_msg = 1;
}
break;
@@ -354,6 +368,7 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as
return err;
}
+
/* Try to connect to the agent via socket or start it if it is not
running and AUTOSTART is set. Handle the server's initial
greeting. Returns a new assuan context at R_CTX or an error
@@ -480,7 +495,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
log_error ("failed to start agent '%s': %s\n",
agent_program, gpg_strerror (err));
else
- err = wait_for_sock (SECS_TO_WAIT_FOR_AGENT, "agent",
+ err = wait_for_sock (SECS_TO_WAIT_FOR_AGENT, 0,
sockname, verbose, ctx, &did_success_msg);
}
@@ -614,7 +629,7 @@ start_new_dirmngr (assuan_context_t *r_ctx,
log_error ("failed to start the dirmngr '%s': %s\n",
dirmngr_program, gpg_strerror (err));
else
- err = wait_for_sock (SECS_TO_WAIT_FOR_DIRMNGR, "dirmngr",
+ err = wait_for_sock (SECS_TO_WAIT_FOR_DIRMNGR, 1,
sockname, verbose, ctx, &did_success_msg);
}