[email protected]
[Top] [All Lists]

Re: [patch] fix warnings with -D_FORTIFY_SOURCE and -Wformat-security

Subject: Re: [patch] fix warnings with -D_FORTIFY_SOURCE and -Wformat-security
From: Gerald Pfeifer
Date: Sun, 15 Mar 2009 23:47:13 +0100 CET
Matthias,

On Sun, 15 Mar 2009, Matthias Klose wrote:
> when GCC is built with a compiler which has some hardening options 
> turned on by default, the build fails when configured without 
> --disable-werror.  This patch fixes all these warnings

I believe

  +  size_t rv_neverused ATTRIBUTE_UNUSED;
     print.src_line += lines;
  -  fwrite (buf, 1, size, print.outf);
  +  rv_neverused = fwrite (buf, 1, size, print.outf);

could also bee written as

     (void) fwrite (buf, 1, size, print.outf);

which looks simpler and expresses the same in a more straightforward
manner.  (If it doesn't work, that may be something to address.)

Gerald

<Prev in Thread] Current Thread [Next in Thread>