home · contact · privacy
Only make exit_err() output errno message if errno is actually set.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 25 Aug 2013 03:03:55 +0000 (05:03 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 25 Aug 2013 03:03:55 +0000 (05:03 +0200)
src/main.c
src/rexit.c

index 2ca2c8cb64b0f477c28c9cf1c3093bdb9104cb34..d1ec7c0ba196314bfa6aee53f53f60b236578ff1 100644 (file)
@@ -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'.";
index d8defc2b4a34a7c5cae5d6896e597566e4698073..31cf3ee724c47b5d0b2184484cae0c180de831a5 100644 (file)
@@ -5,11 +5,13 @@
 #include <stdio.h> /* for printf(), perror() */
 #include <stdint.h> /* for uint8_t */
 #include <ncurses.h> /* for endwin() */
+#include <errno.h> /* 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);
 }