Menu

#65 Check return codes everywhere

open
Jan Kara
None
5
2010-01-05
2009-12-30
No

Some checks for return codes are missing.

Examples:
Would you like to add more error handling for return values from "putchar" like in the function "blit" and from "fputs" in the function "format_print"?
http://linuxquota.cvs.sourceforge.net/viewvc/linuxquota/quota-tools/quotacheck.c?revision=1.58&view=markup
http://linuxquota.cvs.sourceforge.net/viewvc/linuxquota/quota-tools/warnquota.c?revision=1.32&view=markup

Discussion

  • Jan Kara

    Jan Kara - 2010-01-05

    Thanks for the report. In quotacheck I don't know - I'm not sure it would buy us anything. But in case of warnquota it would be nice to check that the write to the stream succeeded. But it's not too high on my priority list so patches are welcome.

     
  • Jan Kara

    Jan Kara - 2010-01-05
    • assigned_to: nobody --> jkar8572
     
  • Markus Elfring

    Markus Elfring - 2010-01-05

    I suggest to avoid unchecked function calls.
    Would you like to detect every error situation as early as possible?

    Would you like to reduce the efforts for error code checking by an exception class hierarchy?
    http://dietmar-kuehl.de/mirror/c++-faq/exceptions.html#faq-17.1
    http://cexcept.sourceforge.net/

     

Anonymous
Anonymous

Add attachments
Cancel