mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-22 19:58:29 +01:00
agent: Improve diagnostics for a bind call failure.
* agent/gpg-agent.c (create_server_socket): Fix translation. Add diagnostic for bind retry. Print windows error code after bind failure. -- GnuPG-bug-id: 7434
This commit is contained in:
parent
3239a41dde
commit
feeceed970
@ -2307,7 +2307,7 @@ create_server_socket (char *name, int primary, int cygwin,
|
|||||||
if (primary && !check_for_running_agent (1))
|
if (primary && !check_for_running_agent (1))
|
||||||
{
|
{
|
||||||
if (steal_socket)
|
if (steal_socket)
|
||||||
log_info (N_("trying to steal socket from running %s\n"),
|
log_info (_("trying to steal socket from running %s\n"),
|
||||||
"gpg-agent");
|
"gpg-agent");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2322,17 +2322,25 @@ create_server_socket (char *name, int primary, int cygwin,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gnupg_remove (unaddr->sun_path);
|
gnupg_remove (unaddr->sun_path);
|
||||||
|
log_info (_("socket file removed - retrying binding\n"));
|
||||||
rc = assuan_sock_bind (fd, addr, len);
|
rc = assuan_sock_bind (fd, addr, len);
|
||||||
}
|
}
|
||||||
if (rc != -1 && (rc=assuan_sock_get_nonce (addr, len, nonce)))
|
if (rc != -1 && (rc=assuan_sock_get_nonce (addr, len, nonce)))
|
||||||
log_error (_("error getting nonce for the socket\n"));
|
log_error (_("error getting nonce for the socket\n"));
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
|
int w32err = 0;
|
||||||
|
|
||||||
|
if (assuan_sock_get_flag (fd, "w32_error", &w32err))
|
||||||
|
w32err = -1; /* Old Libassuan or not Windows. */
|
||||||
|
|
||||||
|
rc = gpg_error_from_syserror ();
|
||||||
/* We use gpg_strerror here because it allows us to get strings
|
/* We use gpg_strerror here because it allows us to get strings
|
||||||
for some W32 socket error codes. */
|
for some W32 socket error codes. */
|
||||||
log_error (_("error binding socket to '%s': %s\n"),
|
log_error (_("error binding socket to '%s': %s\n"),
|
||||||
unaddr->sun_path,
|
unaddr->sun_path, gpg_strerror (rc));
|
||||||
gpg_strerror (gpg_error_from_syserror ()));
|
if (w32err != -1)
|
||||||
|
log_info ("system error code: %d (0x%x)\n", w32err, w32err);
|
||||||
|
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user