From a39476228ea2e98bed073c931721ea45beefc093 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 19 Nov 2020 14:52:41 -0500 Subject: [PATCH] Use Better Exit Codes --- core/src/launcher.c | 4 ++-- mods/include/libcore/libcore.h | 2 +- mods/src/cxx11_util.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/launcher.c b/core/src/launcher.c index de730f3..f9dde29 100644 --- a/core/src/launcher.c +++ b/core/src/launcher.c @@ -72,7 +72,7 @@ static void load(char **ld_path, char **ld_preload, char *folder) { } else if (errno != 0) { // Error Reading Contents Of Folder fprintf(stderr, "Error Reading Directory: %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } else { break; } @@ -94,7 +94,7 @@ static void load(char **ld_path, char **ld_preload, char *folder) { } else { // Unable To Open Folder fprintf(stderr, "Error Opening Directory: %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } } } diff --git a/mods/include/libcore/libcore.h b/mods/include/libcore/libcore.h index 42f43fa..08c637a 100644 --- a/mods/include/libcore/libcore.h +++ b/mods/include/libcore/libcore.h @@ -11,7 +11,7 @@ extern "C" { #include #define INFO(msg, ...) fprintf(stderr, "[INFO]: " msg "\n", __VA_ARGS__); -#define ERR(msg, ...) fprintf(stderr, "[ERR]: " msg "\n", __VA_ARGS__); exit(1); +#define ERR(msg, ...) fprintf(stderr, "[ERR]: " msg "\n", __VA_ARGS__); exit(EXIT_FAILURE); #define HOOK(name, return_type, args) \ typedef return_type (*name##_t)args; \ diff --git a/mods/src/cxx11_util.h b/mods/src/cxx11_util.h index 9823f87..4275d72 100644 --- a/mods/src/cxx11_util.h +++ b/mods/src/cxx11_util.h @@ -1,6 +1,6 @@ #ifndef CXX_11_UTIL_H -#define CXX_11_UTIL +#define CXX_11_UTIL_H #ifdef __cplusplus extern "C" {