]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: debug: fix build warning by consuming the write() result
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Jan 2021 14:58:26 +0000 (15:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Jan 2021 14:58:26 +0000 (15:58 +0100)
When writing commit a8459b28c ("MINOR: debug: create
ha_backtrace_to_stderr() to dump an instant backtrace") I just forgot
that some distros are a bit extremist about the syscall return values.

  src/debug.c: In function `ha_backtrace_to_stderr':
  src/debug.c:147:3: error: ignoring return value of `write', declared with attribute warn_unused_result [-Werror=unused-result]
     write(2, b.area, b.data);
     ^~~~~~~~~~~~~~~~~~~~~~~~
    CC      src/h1_htx.o

Let's apply the usual tricks to shut them up. No backport is needed.

src/debug.c

index fc2de92f07d635c54afe2fcf00f5e74776588adf..bf64f19f05daa52023beb918de04acdf1628e1d1 100644 (file)
@@ -144,7 +144,7 @@ void ha_backtrace_to_stderr()
 
        ha_dump_backtrace(&b, "  ", 4);
        if (b.data)
-               write(2, b.area, b.data);
+               DISGUISE(write(2, b.area, b.data));
 }
 
 /* Dumps to the buffer some known information for the desired thread, and