Unfortunately the direct cast to void doesn't suppress the warning. I tried that
first before using the variable assignment (which then required a cast to void
to avoid an unused variable warning!)
Ideally, you should actually check the return value to make sure there wasn't an
error (-1 returned) or an incomplete write (the number of bytes written is less
than the count argument).
----- Original Message ----
From: Igor Sysoev <is...@rambler-co.ru>
To: ngi...@sysoev.ru
Sent: Monday, November 10, 2008 12:34:37 PM
Subject: Re: Compilation errors on Ubuntu 8.10 Intrepid Ibex
On Mon, Nov 10, 2008 at 09:38:39AM -0800, Eric Benson wrote:
Compiling either 0.6.32 or 0.7.20 on a new Ubuntu 8.10 installation with gcc
4.3.2 causes errors due to a new compiler warning (when combined with the use of
-Werror in CFLAGS). There is now a compiler warning when the return value of
write() is ignored. This causes errors in a number of placees in nginx. I have
included a log showing the compiler output as well as a patch file showing the
changes I made to avoid these errors.
Thank you.
However, there is more elegant way to suppress this warning without
stub variables:
(void) write_fd(...)
Could you test the attached patch ?