From: Cristian Rodríguez Date: Sat, 22 Nov 2025 13:41:08 +0000 (-0300) Subject: lsfd: fix bsearch macro usage with glibc C23 X-Git-Tag: v2.41.3~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a05b701f8a0515952e89b25b8db2bd7fb23331e5;p=thirdparty%2Futil-linux.git lsfd: fix bsearch macro usage with glibc C23 C23 requires bsearch to be a const preserving macro, build now fails with ../lsfd-cmd/lsfd.c:1879:75: error: macro ‘bsearch’ passed 6 arguments, but takes just 5 1879 | nfds, sizeof(struct pollfd), pollfdcmp)) | ^ In file included from ../include/c.h:17, from ../lsfd-cmd/lsfd.c:48: /usr/include/stdlib.h:987:10: note: macro ‘bsearch’ defined here 987 | # define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR) \ add parenthesis around expression to fix it. (cherry picked from commit 711bda1441561bfd2eb6d45fe0bc789535c1f1a8) --- diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c index 75cd1de58..9aae240fc 100644 --- a/lsfd-cmd/lsfd.c +++ b/lsfd-cmd/lsfd.c @@ -1836,7 +1836,7 @@ static void mark_poll_fds_as_multiplexed(char *buf, struct file *file = list_entry(f, struct file, files); if (is_opened_file(file) && !file->multiplexed) { int fd = file->association; - if (bsearch(&(struct pollfd){.fd = fd,}, local.iov_base, + if (bsearch((&(struct pollfd){.fd = fd,}), local.iov_base, nfds, sizeof(struct pollfd), pollfdcmp)) file->multiplexed = 1; }