Browse Source

Fix FD_SETSIZE comparision warnings on FreeBSD

* And again, FreeBSD sucks... it defines FD_SETSIZE as an unsigned integer,
  while every fd is signed.
  This obviously breaks thinks like assert(fd < FD_SETSIZE);


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2570 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Stefan Bühler 13 years ago
parent
commit
2ab8287e32
  1. 1
      NEWS
  2. 2
      src/fdevent_select.c
  3. 8
      src/server.c

1
NEWS

@ -11,6 +11,7 @@ NEWS
* Add server.breakagelog, a "special" stderr (fixes #1863)
* Fix config evaluation for debug.log-timeouts option (#1529)
* Add "cgi.execute-x-only" to mod_cgi, requires +x for cgi scripts (fixes #2013)
* Fix FD_SETSIZE comparision warnings
- 1.4.23 - 2009-06-19
* Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)

2
src/fdevent_select.c

@ -38,7 +38,7 @@ static int fdevent_select_event_add(fdevents *ev, int fde_ndx, int fd, int event
UNUSED(fde_ndx);
/* we should be protected by max-fds, but you never know */
assert(fd < FD_SETSIZE);
assert(fd < ((int)FD_SETSIZE));
if (events & FDEVENT_IN) {
FD_SET(fd, &(ev->select_set_read));

8
src/server.c

@ -719,7 +719,7 @@ int main (int argc, char **argv) {
}
if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
srv->max_fds = rlim.rlim_cur < FD_SETSIZE - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
srv->max_fds = rlim.rlim_cur < ((int)FD_SETSIZE) - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
} else {
srv->max_fds = rlim.rlim_cur;
}
@ -732,7 +732,7 @@ int main (int argc, char **argv) {
#endif
if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
/* don't raise the limit above FD_SET_SIZE */
if (srv->max_fds > FD_SETSIZE - 200) {
if (srv->max_fds > ((int)FD_SETSIZE) - 200) {
log_error_write(srv, __FILE__, __LINE__, "sd",
"can't raise max filedescriptors above", FD_SETSIZE - 200,
"if event-handler is 'select'. Use 'poll' or something else or reduce server.max-fds.");
@ -845,7 +845,7 @@ int main (int argc, char **argv) {
}
if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
srv->max_fds = rlim.rlim_cur < FD_SETSIZE - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
srv->max_fds = rlim.rlim_cur < ((int)FD_SETSIZE) - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
} else {
srv->max_fds = rlim.rlim_cur;
}
@ -859,7 +859,7 @@ int main (int argc, char **argv) {
#endif
if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
/* don't raise the limit above FD_SET_SIZE */
if (srv->max_fds > FD_SETSIZE - 200) {
if (srv->max_fds > ((int)FD_SETSIZE) - 200) {
log_error_write(srv, __FILE__, __LINE__, "sd",
"can't raise max filedescriptors above", FD_SETSIZE - 200,
"if event-handler is 'select'. Use 'poll' or something else or reduce server.max-fds.");

Loading…
Cancel
Save