From 6d85ea782042d11762176ae95757c03a809cf2bb Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Fri, 6 Jan 2006 22:12:46 +0000 Subject: [PATCH] Fix FD_ISSET() on LP64 platforms. The FD_ISSET() function/macro is defined to return an int, but on LP64 platforms the return value of FD_ISSET() for file descriptors with a bit-index larger than 31 would not fit an int (due to __fd_mask being defined as an unsigned long). The fix is to explicitly test against 0. PR: ia64/91421 Submitted by: Tanaka Akira (akr at m17n dot org) MFC after: 1 week --- sys/sys/select.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/select.h b/sys/sys/select.h index 342a8491fb1..511895b3c81 100644 --- a/sys/sys/select.h +++ b/sys/sys/select.h @@ -80,7 +80,7 @@ typedef struct fd_set { #if __BSD_VISIBLE #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif -#define FD_ISSET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) +#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) #define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) #define FD_ZERO(p) do { \ fd_set *_p; \