]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: fd: split the fd check
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Jul 2022 08:35:24 +0000 (10:35 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Jul 2022 08:35:24 +0000 (10:35 +0200)
Split the BUG_ON(fd < 0 || fd >= global.maxsock) so it's easier to know
if it quits because of a -1.

include/haproxy/fd.h

index e8ef4f3bcd0a125ba2e2d769e17db92d9fc6f36d..8925efb66e0d966a4331da559eff39d487310e82 100644 (file)
@@ -433,7 +433,8 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), int tgid
        /* This must never happen and would definitely indicate a bug, in
         * addition to overwriting some unexpected memory areas.
         */
-       BUG_ON(fd < 0 || fd >= global.maxsock);
+       BUG_ON(fd < 0);
+       BUG_ON(fd >= global.maxsock);
        BUG_ON(fdtab[fd].owner != NULL);
        BUG_ON(fdtab[fd].state != 0);
        BUG_ON(tgid < 1 || tgid > MAX_TGROUPS);