summaryrefslogtreecommitdiffstats
path: root/tools/inetcat.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-11-25 17:36:37 +0100
committerGravatar Nikias Bassen2026-11-25 17:36:37 +0100
commit9e277ffea2f43d95e1c39af5a181958547b88592 (patch)
treeae7bc6d27d6267173e6f83737732f56697ccfb5b /tools/inetcat.c
parent2b5bbb8966e240fa352ef0ec09bef84d0507c8ea (diff)
downloadlibusbmuxd-9e277ffea2f43d95e1c39af5a181958547b88592.tar.gz
libusbmuxd-9e277ffea2f43d95e1c39af5a181958547b88592.tar.bz2
tools: Fix -Wsign-compare warnings from FD_SET on WindowsHEADmaster
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.
Diffstat (limited to 'tools/inetcat.c')
-rw-r--r--tools/inetcat.c9
1 files changed, 8 insertions, 1 deletions
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 <signal.h>
#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 <basetsd.h>
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];