From 41cf76b8c142b1d34aa817744fb6fd0e276c2709 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 5 Mar 2025 10:24:14 +0100 Subject: 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. --- common/asshelp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/asshelp.c') 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, -- cgit v1.2.3