Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Possible unsafe use of strncat in sbin/sysctl/sysctl.c



On 8/23/11 6:22 PM, Marc Balmer wrote:
Am 24.08.11 00:08, schrieb Joerg Sonnenberger:
On Tue, Aug 23, 2011 at 09:58:53PM +0000, David Holland wrote:
On Tue, Aug 23, 2011 at 11:52:11PM +0200, Marc Balmer wrote:
  >  (void)wait!  That was a pure personal remark.  I really don't know where
  >  that (void)bla idiom comes from, and I obviously don't (void)like it.

It's an artifact of our stupid lint(1).

Not really, it is used by other analyzers to mean "yes, I know this
returns something, but I don't care". The major exception of course is
that GCC broke it for the attributed usage -- half of the pain of
dealing with modern glibc in this regard.

But that is kind of, well, unneeded.  A compiler can detect that I don't
use the return value by seeing that I don't use the return value.

What GCC/glibc did is enforce the checking of unused values from most libc/syscall functions. Putting (void) in front of these calls does not shut the warnings up.

Home | Main Index | Thread Index | Old Index