From: Lev Stipakov Date: Fri, 10 Feb 2023 13:31:59 +0000 (+0200) Subject: Improve format specifier for socket handle in Windows X-Git-Tag: v2.7_alpha1~553 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6731314a82d1a3c76b5497749985ee20c0c7d8eb;p=thirdparty%2Fopenvpn.git Improve format specifier for socket handle in Windows Socket is a handle on Windows, which is usually logged in hex. Also an interesting value is INVALID_SOCKET, which is ~0. PRIuPTR prints decimals, and for INVALID_SOCKET it prints something like 2023-02-10 14:45:21 us=906000 write to TUN/TAP : Jrjestelmkutsulle annettu data-alue on liian pieni. (fd=18446744073709551615,code=122) PRIxPTR prints hex, and INVALID_SOCKET looks a bit nicer: 2023-02-10 15:17:11 us=828000 write to TUN/TAP : Jrjestelmkutsulle annettu data-alue on liian pieni. (fd=ffffffffffffffff,code=122) Reported-by: Selva Nair Signed-off-by: Lev Stipakov Acked-by: Frank Lichtenheld Acked-by: Antonio Quartulli Message-Id: <20230210133159.1336-1-lstipakov@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26220.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index 12ccf2f4d..533592255 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -441,7 +441,7 @@ typedef unsigned short sa_family_t; */ #ifdef _WIN32 #define SOCKET_UNDEFINED (INVALID_SOCKET) -#define SOCKET_PRINTF "%" PRIuPTR +#define SOCKET_PRINTF "%" PRIxPTR typedef SOCKET socket_descriptor_t; #else #define SOCKET_UNDEFINED (-1)