]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: consume the write() result in BUG_ON() to silence a warning
authorWilly Tarreau <w@1wt.eu>
Sat, 14 Mar 2020 09:58:35 +0000 (10:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 14 Mar 2020 09:58:35 +0000 (10:58 +0100)
Tim reported that BUG_ON() issues warnings on his distro, as the libc marks
some syscalls with __attribute__((warn_unused_result)). Let's pass the
write() result through DISGUISE() to hide it.

include/common/debug.h

index df855222915bbbad6591e77aa864ee977daefc18..c6c154cde78d7884f6c26fe1a52620438e8bf947 100644 (file)
@@ -59,7 +59,7 @@
        do {                                                                   \
                if (unlikely(cond)) {                                          \
                        const char msg[] = "\nFATAL: bug condition \"" #cond "\" matched at " file ":" #line "\n"; \
-                       (void)write(2, msg, strlen(msg));                      \
+                       DISGUISE(write(2, msg, strlen(msg)));                  \
                        CRASH_NOW();                                           \
                }                                                              \
        } while (0)