]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2363: Install Error: comparison between signed and unsigned int
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 13 Sep 2008 11:59:49 +0000 (23:59 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 13 Sep 2008 11:59:49 +0000 (23:59 +1200)
FreeBSD 7 now define FD_SETSIZE as unsigned. However squid needs to compare it
against signed values on occasion. This casts the squid internal FD limit macro
to ensure its signed.

A better fix may be to audit the code and completely change all FD_SET*
handling codepaths to handle and pass values of a custom signedness
as determined by the OS at build time.

src/squid.h

index dde30698f8d94ef26729cb928fa6cd716862fb23..1f35b75cd371735dd2ccd28e9d6cd301b153efa8 100644 (file)
@@ -196,13 +196,18 @@ using namespace Squid;
 
 /*
  * Filedescriptor limits in the different select loops
+ *
+ * NP: FreeBSD 7 defines FD_SETSIZE as unsigned but Squid needs
+ *     it to be signed to compare it with signed values.
+ *     Linux and others including FreeBSD <7, define it as signed.
+ *     If this causes any issues please contact squid-dev@squid-cache.org
  */
 #if defined(USE_SELECT) || defined(USE_SELECT_WIN32)
 /* Limited by design */
-# define SQUID_MAXFD_LIMIT FD_SETSIZE
+# define SQUID_MAXFD_LIMIT ((signed int)FD_SETSIZE)
 #elif defined(USE_POLL)
 /* Limited due to delay pools */
-# define SQUID_MAXFD_LIMIT FD_SETSIZE
+# define SQUID_MAXFD_LIMIT ((signed int)FD_SETSIZE)
 #elif defined(USE_KQUEUE) || defined(USE_EPOLL)
 # define SQUID_FDSET_NOUSE 1
 #else