Re: Is allowed in certain cases to override default Fedora compiler flags?

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

 



Sergio Belkin wrote:
> Thanks everyone, I guess the same thing goes for:
> 
> warning: ignoring return value of 'ssize_t write(int, const void*, size_t)'
> declared with attribute 'warn_unused_result'
> 
> (The line in the source code  is if(upLogPerror) ::write(2,logbuf,n); \  )
> 
> doesn't it?

Ignoring the result of write is usually a serious bug. However, that
line looks like it writes a log message to the standard error stream,
and in that specific case there might not be anything meaningful the
program can do if write fails, if it doesn't want to terminate with an
error status. Logging an error message about how logging failed could
easily lead to infinite recursion.

So depending on what other error reporting mechanisms are available to
the program, it may be reasonable to ignore the function result in this
case, but it should be done by tweaking the code to silence the
compiler warning for that call only. Disabling -Wunused-result for the
whole program is not a good idea.

Björn Persson

Attachment: pgp2rdY1_EBad.pgp
Description: OpenPGP digital signatur

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux