#17 EXIT_SUCCESS (0) returned on failure

closed-invalid
Joe Drew
5
2004-11-15
2002-11-02
No

mpg321 returns EXIT_SUCCESS (0) even when an error has
occured (for example file not found).

Appropriate return values would enable detection of errors.

Original mpg123 returns EXIT_FAILURE (1) on errors (for
example file not found).

#include <stdlib.h>

gives

#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1

Thanks.

Discussion

  • Nicolas Bonifas

    Nicolas Bonifas - 2004-11-13

    Logged In: YES
    user_id=719421

    mpg321 returns EXIT_FAILURE for *most* errors. It doesn't
    for some, especially when it can't open a file. In that
    case, mpg123 will return an error message and stop parsing
    the list of files. mpg321 just prints an error message and
    keeps parsing the list. Both behaviours have their pros and
    cons. I personally prefer mpg321's one, but we will let the
    main developpers choose.
    Nevertheless, you can easily mimic mpg123's behaviour by
    just adding the line "exit(1);" after the comment "/* mpg123
    stops immediately if it can't open a file */", in mpg321.c

     
  • Stephen Depooter

    • status: open --> closed-invalid
     
  • Stephen Depooter

    Logged In: YES
    user_id=712646

    With regards to failure to open a file, I will continue to
    keep playing the rest of the playlist, rather than exit in
    this case. If there are other cases of real errors where
    mpg321 does not continue, please let us know.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks