From: Christian Heller Date: Sun, 25 Aug 2013 03:03:55 +0000 (+0200) Subject: Only make exit_err() output errno message if errno is actually set. X-Git-Tag: tce~1054 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/%7B%7Btodo.date%7D%7D?a=commitdiff_plain;h=f92f23955f2aec3bf90dce810706f8a6062f6c72;p=plomrogue Only make exit_err() output errno message if errno is actually set. --- diff --git a/src/main.c b/src/main.c index 2ca2c8c..d1ec7c0 100644 --- a/src/main.c +++ b/src/main.c @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) err_x = "Trouble recording new seed: " "A file 'record' already exists, when it shouldn't."; err_o = "Trouble recording new seed (fopen() in main()) / " - "opening'record_tmp' file for writing."; + "opening 'record_tmp' file for writing."; char * err_w = "Trouble recording new seed " "(write_uint32_bigendian() in main()) / writing to " "opened file 'record_tmp'."; diff --git a/src/rexit.c b/src/rexit.c index d8defc2..31cf3ee 100644 --- a/src/rexit.c +++ b/src/rexit.c @@ -5,11 +5,13 @@ #include /* for printf(), perror() */ #include /* for uint8_t */ #include /* for endwin() */ +#include /* for errno */ #include "main.h" /* for World struct */ #include "map.h" /* for Map struct */ #include "keybindings.h" /* for KeysWinData, KeyBinding structs */ + /* The clean-up routine and the flag resource by which it decides what to do. */ static uint8_t cleanup_flags = 0x00; static void cleanup(struct World * world); @@ -71,6 +73,9 @@ extern void exit_err(uint8_t err, struct World * world, char * msg) msg = "Details unknown."; } printf("Aborted PlomRogue due to error. %s\n", msg); - perror("errno states"); + if (0 != errno) + { + perror("errno states"); + } exit(EXIT_FAILURE); }