Menu

#491 check return codes everywhere

Not_Started_(0%)
open
nobody
None
2
2007-03-26
2007-03-26
No

Some checks for return codes are missing.

Examples:
Would you like to add more error handling for return values from "sscanf"
like in the function "ay_read_unistring" and from "fprintf" in the function
"ay_write_header"?
http://ayam.cvs.sourceforge.net/ayam/ayam/src/aycore/read.c?revision=1.32&v
iew=markup
http://ayam.cvs.sourceforge.net/ayam/ayam/src/aycore/write.c?revision=1.12&
view=markup

Discussion

  • Markus Elfring

    Markus Elfring - 2007-03-27

    Logged In: YES
    user_id=572001
    Originator: NO

    I suggest to avoid all unchecked function calls.

    Can you imagine that the file output will fail in a reproducible way?

     
  • Randolf Schultz

    Randolf Schultz - 2007-03-27

    Logged In: YES
    user_id=125929
    Originator: YES

    Greetings,

    yes, that is why ay_write_scene() is checking errno and
    ferror(fileptr) after all objects have been written.
    In the case of a full disk, the most likely cause of
    a failed write, this should be sufficient (tested on
    Linux).
    If there is a way to create a mangled Ayam scene file
    using normal user input without those checks raising
    a visible error message: please tell.

    best regards,
    Randolf

     
  • Markus Elfring

    Markus Elfring - 2007-03-27

    Logged In: YES
    user_id=572001
    Originator: NO

    I read your source code in a way that your check that happens after all output should be performed may be too late because parts of the execution of the instruction "ay_write_header(fileptr);" (line 331) failed earlier.
    Would you like to detect every error situation as early as possible?

     

Log in to post a comment.