libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 1777068bd81603228f0c7e3e20005769aeba838e
parent 16d9f9e426a8ea1f5c05a21554824b7981c0df3b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu, 15 Oct 2020 17:04:02 +0300

mhd_send: round up readahead size on FreeBSD

Diffstat:
Msrc/microhttpd/mhd_send.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -84,7 +84,7 @@ MHD_send_init_static_vars_ (void) * SF_FLAGS defined only on FreeBSD 11 and later. */ #ifdef SF_FLAGS long sys_page_size = sysconf (_SC_PAGESIZE); - if (0 > sys_page_size) + if (0 >= sys_page_size) { /* Failed to get page size. */ freebsd_sendfile_flags_ = SF_NODISKIO; freebsd_sendfile_flags_thd_p_c_ = SF_NODISKIO; @@ -92,10 +92,11 @@ MHD_send_init_static_vars_ (void) else { freebsd_sendfile_flags_ = - SF_FLAGS ((uint16_t) (MHD_SENFILE_CHUNK_ / sys_page_size), SF_NODISKIO); + SF_FLAGS ((uint16_t) ((MHD_SENFILE_CHUNK_ + sys_page_size - 1) + / sys_page_size), SF_NODISKIO); freebsd_sendfile_flags_thd_p_c_ = - SF_FLAGS ((uint16_t) (MHD_SENFILE_CHUNK_THR_P_C_ / sys_page_size), - SF_NODISKIO); + SF_FLAGS ((uint16_t) ((MHD_SENFILE_CHUNK_THR_P_C_ + sys_page_size - 1) + / sys_page_size), SF_NODISKIO); } #endif /* SF_FLAGS */ }