tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 405c5ac1e4cd8aa1376f021d0b4c26cad3be241d
parent d7cf8f3fd1ff721952f87846aa71fdb0c3ab2e54
Author: Alexander Hansen Færøy <ahf@torproject.org>
Date:   Thu, 12 Feb 2026 00:15:32 +0100

Mark module local Windows variables as static.

This patch fixes a build issue on Debian Trixie with Mingw64 where the
compiler now checks for whether non-static variables are defined
elsewhere first, otherwise errors out.

This patch changes our `services_fns` and `windows_socket_errors`
variables to use a pre-declared type on the form `struct x { ... } x_t;`
and mark the instance as static.

Diffstat:
Msrc/app/main/ntmain.c | 6++++--
Msrc/lib/net/socket.c | 8+++++++-
2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/app/main/ntmain.c b/src/app/main/ntmain.c @@ -66,7 +66,7 @@ static int nt_service_cmd_stop(void); /** Struct to hold dynamically loaded NT-service related function pointers. */ -struct { +typedef struct nt_services { int loaded; /** @{ */ @@ -143,7 +143,9 @@ struct { LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse); /** @} */ -} service_fns = { 0, +} nt_services_t; + +static nt_services_t service_fns = { 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; diff --git a/src/lib/net/socket.c b/src/lib/net/socket.c @@ -652,7 +652,13 @@ tor_socket_errno(tor_socket_t sock) #if defined(_WIN32) #define E(code, s) { code, (s " [" #code " ]") } -struct { int code; const char *msg; } windows_socket_errors[] = { + +typedef struct windows_socket_error { + int code; + const char *msg; +} windows_socket_error_t; + +static windows_socket_error_t windows_socket_errors[] = { E(WSAEINTR, "Interrupted function call"), E(WSAEACCES, "Permission denied"), E(WSAEFAULT, "Bad address"),