From fa16dff87059708c548242283ff36beca6eb3fda Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Sun, 23 Feb 2014 21:41:16 +0700 Subject: [PATCH] Do not call abort (on failure) in pretty_plist.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- Applications/pretty_plist/src/pretty_plist.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Applications/pretty_plist/src/pretty_plist.cc b/Applications/pretty_plist/src/pretty_plist.cc index 4797a4e7..26b50e98 100644 --- a/Applications/pretty_plist/src/pretty_plist.cc +++ b/Applications/pretty_plist/src/pretty_plist.cc @@ -1,4 +1,5 @@ #include +#include 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); } }