Subject: coreutils-8.21 possible coding error ?

From: David Binderman <[email-masked]>
Date: Thu, 17 Oct 2013 07:33:33 +0000

Hello there,

I just ran the static analysis tool cppcheck over the source code
of coreutils-8.21

It said many things, including

[src/dircolors.c:445]: (warning) Comparison of a boolean value using relational operator (<,>, <= or>=).

Source code is

  if (!print_database < argc)

Some round brackets might help clarify the code

  if ((!print_database) < argc)

or was perhaps

  if (!(print_database < argc))

intended ? Here are some other things cppcheck found.

[lib/mountlist.c:945]: (error) Resource leak: dirp
[lib/sig2str.c:329]: (warning) Logical conjunction always evaluates to false: signum <= -1 && signum>= 0.
[lib/closein.c:91]: (error) fflush() called on input stream 'stdin' results in undefined behaviour.

Regards

David Binderman