Do not call abort (on failure) in pretty_plist.cc

Instead we return one of the constants from sysexits.h — the problem with abort() is that, for users with the feature enabled, it will trigger a core dump. That is a bit extreme for somewhat expected problems (like empty input file).
This commit is contained in:
Allan Odgaard
2014-02-23 21:41:16 +07:00
parent 6ec2f26d2c
commit fa16dff870

View File

@@ -1,4 +1,5 @@
#include <plist/ascii.h>
#include <sysexits.h>
static double const AppVersion = 2.1;
static size_t const AppRevision = APP_REVISION;
@@ -36,7 +37,7 @@ static void parse_plist (FILE* fp, bool ascii, bool extended)
if(data.empty())
{
fprintf(stderr, "empty property list\n");
abort();
exit(EX_DATAERR);
}
if(ascii)
@@ -109,7 +110,7 @@ int main (int argc, char* const* argv)
else
{
perror("fopen");
abort();
exit(EX_NOINPUT);
}
}