Menu

#3 Check return codes everywhere

open-fixed
None
5
2007-03-07
2007-02-15
No

Some checks for return codes are missing.

Examples:
Would you like to add more error handling for return values from "strdup" like in the function "init_userinfo" and from "malloc" in the function "do_stor"?
http://bftpd.cvs.sourceforge.net/bftpd/bftpd/commands.c?revision=1.27&view=markup

Discussion

  • Jesse Smith

    Jesse Smith - 2007-02-26
    • assigned_to: nobody --> slicer69
    • status: open --> open-accepted
     
  • Jesse Smith

    Jesse Smith - 2007-02-26

    Logged In: YES
    user_id=473129
    Originator: NO

    I'll take a look at this. It can't hurt to be careful.

     
  • Jesse Smith

    Jesse Smith - 2007-03-07

    Logged In: YES
    user_id=473129
    Originator: NO

    I think these have all be covered in the source tree. These checks will appear in
    Bftpd-1.7, coming soon. Thank you.

     
  • Jesse Smith

    Jesse Smith - 2007-03-07
    • status: open-accepted --> closed-fixed
     
  • Markus Elfring

    Markus Elfring - 2007-03-07
    • status: closed-fixed --> open-fixed
     
  • Markus Elfring

    Markus Elfring - 2007-03-07

    Logged In: YES
    user_id=572001
    Originator: YES

    When will the updates be visible in your version repository?

    Would you like to avoid unchecked function calls completely?
    Another example:
    http://bftpd.cvs.sourceforge.net/bftpd/bftpd/logging.c?revision=1.10&view=markup
    bftpd_statuslog => fseek, fprintf, fflush

    Would the approach "http://cexcept.sourceforge.net/" be useful in your software?

     
  • Jesse Smith

    Jesse Smith - 2007-03-12

    Logged In: YES
    user_id=473129
    Originator: NO

    At this time, the bftpd does not use versioning software. It's been pretty much a one-person show
    for the past two years. I'm surprised you found cvs as recent as 1.10.

    To be completely honest, at this point I'm not very interested in checking the return codes on fprintf,
    fseek and fflush. I'm sorry if you disagree. However, in my experience, if a call to fflush() or fprintf() fails,
    the system is probably in very bad shape.

    That being said, if you or anyone else would like to take the time to create a patch to
    check the return codes, I will happily look over it and take the time to apply it upstream.
    Feel free to e-mail patches directly to me, my e-mail address is on the bftpd website.

     
  • Markus Elfring

    Markus Elfring - 2007-03-12

    Logged In: YES
    user_id=572001
    Originator: YES

    1. I would appreciate if your current source files will be integrated into a Subversion repository (at SourceForge).

    2. How do you think about to detect every error situation as early as possible?

    3. Would you like to transform any C code into C++ techniques?
    http://dietmar-kuehl.de/mirror/c++-faq/exceptions.html#faq-17.1

     
  • Jesse Smith

    Jesse Smith - 2007-03-13

    Logged In: YES
    user_id=473129
    Originator: NO

    1. You can get the most recent changes and up to date code at http://bftpd.sourceforge.net. The development releases
    are posted whenever a change is made. Bftpd's development is slow and mostly geared toward minor enhancement and
    bug fixes.

    2. I would like to get any critical error as soon as possible and deal with it. Most problems that would cause Bftpd
    to fail in its task are picked up and reported. If you're running into cases where Bftpd is crashing and you
    can't find a reason, please let me know. Or, if you have a patch to detect errors, please submit it.

    3. I am not going to translate Bftpd from C into any other language, including C++. The FAQ you link to is
    not relavent to Bftpd development.

     
  • Markus Elfring

    Markus Elfring - 2007-03-13

    Logged In: YES
    user_id=572001
    Originator: YES

    2. Error codes should always be checked. Otherwise, it might not be noticed that anything unexpected happened.

     
MongoDB Logo MongoDB