From 9e277ffea2f43d95e1c39af5a181958547b88592 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 25 Nov 2026 17:36:37 +0100 Subject: tools: Fix -Wsign-compare warnings from FD_SET on Windows FD_SET compares the descriptor to a SOCKET (unsigned) on Windows, which triggers -Wsign-compare for our int descriptors. Cast to SOCKET there via a small FD_SET_FD helper. --- tools/inetcat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools/inetcat.c') diff --git a/tools/inetcat.c b/tools/inetcat.c index 906b5c9..2410011 100644 --- a/tools/inetcat.c +++ b/tools/inetcat.c @@ -50,6 +50,13 @@ #include #endif +/* avoid -Wsign-compare: FD_SET compares against SOCKET (unsigned) on Windows */ +#ifdef _WIN32 +#define FD_SET_FD(fd, set) FD_SET((SOCKET)(fd), (set)) +#else +#define FD_SET_FD(fd, set) FD_SET((fd), (set)) +#endif + #ifdef _MSC_VER #include typedef SSIZE_T ssize_t; @@ -258,7 +265,7 @@ int main(int argc, char **argv) fd_set fds; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); - FD_SET(devfd, &fds); + FD_SET_FD(devfd, &fds); int ret = 0; uint8_t buf[4096]; -- cgit v1.1-32-gdbae