aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-03-05 09:24:14 +0000
committerWerner Koch <[email protected]>2025-03-05 09:24:50 +0000
commit41cf76b8c142b1d34aa817744fb6fd0e276c2709 (patch)
tree90a2b7dc60b517301480313839f76213c7f042bb /common
parenttools: Add envvar GPG_AUTHCODE_SIGN_MODE to disable signing. (diff)
downloadgnupg-41cf76b8c142b1d34aa817744fb6fd0e276c2709.tar.gz
gnupg-41cf76b8c142b1d34aa817744fb6fd0e276c2709.zip
Log the Windows system error code at more places.
* common/asshelp.c (log_libassuan_system_error): New. * agent/gpg-agent.c (create_server_socket): Use new log function. (handle_connections): Log system error code for a failed accept. * dirmngr/dirmngr.c (handle_connections): Ditto. * kbx/keyboxd.c (handle_connections): Ditto. * scd/scdaemon.c (handle_connections): Ditto. * tpm2d/tpm2daemon.c (handle_connections): Ditto. * dirmngr/dirmngr.c (main): Log system error code for a failed bin. * kbx/keyboxd.c (create_server_socket): Ditto. * scd/scdaemon.c (create_server_socket): Ditto. * tpm2d/tpm2daemon.c (create_server_socket): Ditto.
Diffstat (limited to 'common')
-rw-r--r--common/asshelp.c15
-rw-r--r--common/asshelp.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/common/asshelp.c b/common/asshelp.c
index 6706154cd..0152d1243 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -128,6 +128,21 @@ set_libassuan_log_cats (unsigned int newcats)
}
+/* Get the last Windows error from an Assuan socket function and print
+ * the raw error code using log_info. */
+void
+log_libassuan_system_error (assuan_fd_t fd)
+{
+ int w32err = 0;
+
+ if (assuan_sock_get_flag (fd, "w32_error", &w32err))
+ w32err = -1; /* Old Libassuan or not Windows. */
+
+ if (w32err != -1)
+ log_info ("system error code: %d (0x%x)\n", w32err, w32err);
+}
+
+
static gpg_error_t
send_one_option (assuan_context_t ctx, gpg_err_source_t errsource,
diff --git a/common/asshelp.h b/common/asshelp.h
index bca50759d..cde6e226f 100644
--- a/common/asshelp.h
+++ b/common/asshelp.h
@@ -46,6 +46,8 @@ void setup_libassuan_logging (unsigned int *debug_var_address,
const char *msg));
void set_libassuan_log_cats (unsigned int newcats);
+void log_libassuan_system_error (assuan_fd_t fd);
+
gpg_error_t
send_pinentry_environment (assuan_context_t ctx,