1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-14 00:19:50 +02:00

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: 0471ff9d3b
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2017-11-15 13:47:48 +01:00
parent 08a4b3bc41
commit 4a7fe9a596
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -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 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; gpg_error_t err = 0;
int target_us = secs * 1000000; 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; secsleft = (target_us - elapsed_us)/1000000;
if (secsleft < lastalert) if (secsleft < lastalert)
{ {
log_info (_("waiting for the %s to come up ... (%ds)\n"), log_info (which == 1?
name, secsleft); _("waiting for the dirmngr to come up ... (%ds)\n"):
_("waiting for the agent to come up ... (%ds)\n"),
secsleft);
lastalert = secsleft; lastalert = secsleft;
} }
} }
@ -341,8 +354,9 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as
{ {
if (verbose) if (verbose)
{ {
log_info (_("connection to %s established\n"), log_info (which == 1?
name); _("connection to the dirmngr established\n"):
_("connection to agent established\n"));
*did_success_msg = 1; *did_success_msg = 1;
} }
break; break;
@ -354,6 +368,7 @@ wait_for_sock (int secs, const char *name, const char *sockname, int verbose, as
return err; return err;
} }
/* Try to connect to the agent via socket or start it if it is not /* 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 running and AUTOSTART is set. Handle the server's initial
greeting. Returns a new assuan context at R_CTX or an error 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", log_error ("failed to start agent '%s': %s\n",
agent_program, gpg_strerror (err)); agent_program, gpg_strerror (err));
else 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); 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", log_error ("failed to start the dirmngr '%s': %s\n",
dirmngr_program, gpg_strerror (err)); dirmngr_program, gpg_strerror (err));
else 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); sockname, verbose, ctx, &did_success_msg);
} }