[PATCH] Fix build error: unused-result

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 30 06:20:32 PDT 2013


On 30/05/13 13:54, Chengwei Yang wrote:
> +            unused = write (STDERR_FILENO, message, strlen (message));
> +            _exit (1 || unused);

Instead of adding increasingly elaborate schemes to have gcc not spot
that a value is unused, I would rather either handle the write failure
(not really an option here, because what else would we do about it?), or
do something that makes it clear that it is deliberately ignored,
something like this:

    if (write (...) < strlen (message))
      {
        /* ignore failure to write out a warning */
      }

That makes it clear that it's deliberately ignored.

    S



More information about the dbus mailing list