From 0ed94fc7880e7663ad4b984a6512337670f6ae9e Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Thu, 16 Jan 2020 09:21:27 +0100 Subject: [PATCH] Use EXIT_SUCCESS/FAILURE instead of 0/1 --- src/commands.c | 2 +- src/commands_parser.c | 4 ++-- src/config_parser.c | 4 ++-- src/fake_outputs.c | 2 +- src/handlers.c | 2 +- src/main.c | 2 +- src/sighandler.c | 2 +- src/startup.c | 2 +- src/util.c | 2 +- src/xinerama.c | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/commands.c b/src/commands.c index dec4d7a3..15a47d94 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1582,7 +1582,7 @@ void cmd_layout_toggle(I3_CMD, const char *toggle_mode) { */ void cmd_exit(I3_CMD) { LOG("Exiting due to user command.\n"); - exit(0); + exit(EXIT_SUCCESS); /* unreached */ } diff --git a/src/commands_parser.c b/src/commands_parser.c index d4ae430b..f734a7aa 100644 --- a/src/commands_parser.c +++ b/src/commands_parser.c @@ -106,7 +106,7 @@ static void push_string(const char *identifier, char *str) { fprintf(stderr, "BUG: commands_parser stack full. This means either a bug " "in the code, or a new command which contains more than " "10 identified tokens.\n"); - exit(1); + exit(EXIT_FAILURE); } // TODO move to a common util @@ -128,7 +128,7 @@ static void push_long(const char *identifier, long num) { fprintf(stderr, "BUG: commands_parser stack full. This means either a bug " "in the code, or a new command which contains more than " "10 identified tokens.\n"); - exit(1); + exit(EXIT_FAILURE); } // TODO move to a common util diff --git a/src/config_parser.c b/src/config_parser.c index c238f1b9..bbeca576 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -126,7 +126,7 @@ static void push_string(const char *identifier, const char *str) { fprintf(stderr, "BUG: config_parser stack full. This means either a bug " "in the code, or a new command which contains more than " "10 identified tokens.\n"); - exit(1); + exit(EXIT_FAILURE); } static void push_long(const char *identifier, long num) { @@ -146,7 +146,7 @@ static void push_long(const char *identifier, long num) { fprintf(stderr, "BUG: config_parser stack full. This means either a bug " "in the code, or a new command which contains more than " "10 identified tokens.\n"); - exit(1); + exit(EXIT_FAILURE); } static const char *get_string(const char *identifier) { diff --git a/src/fake_outputs.c b/src/fake_outputs.c index 5f3622d4..e69acc8a 100644 --- a/src/fake_outputs.c +++ b/src/fake_outputs.c @@ -82,6 +82,6 @@ void fake_outputs_init(const char *output_spec) { if (num_screens == 0) { ELOG("No screens found. Please fix your setup. i3 will exit now.\n"); - exit(0); + exit(EXIT_FAILURE); } } diff --git a/src/handlers.c b/src/handlers.c index 1d73ccff..24919b28 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -441,7 +441,7 @@ static void handle_screen_change(xcb_generic_event_t *e) { xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(conn, cookie, NULL); if (reply == NULL) { ELOG("Could not get geometry of the root window, exiting\n"); - exit(1); + exit(EXIT_FAILURE); } DLOG("root geometry reply: (%d, %d) %d x %d\n", reply->x, reply->y, reply->width, reply->height); diff --git a/src/main.c b/src/main.c index aa1074a8..42d15735 100644 --- a/src/main.c +++ b/src/main.c @@ -434,7 +434,7 @@ int main(int argc, char *argv[]) { } if (only_check_config) { - exit(load_configuration(override_configpath, C_VALIDATE) ? 0 : 1); + exit(load_configuration(override_configpath, C_VALIDATE) ? EXIT_SUCCESS : EXIT_FAILURE); } /* If the user passes more arguments, we act like i3-msg would: Just send diff --git a/src/sighandler.c b/src/sighandler.c index e49c30ba..9f40e7d1 100644 --- a/src/sighandler.c +++ b/src/sighandler.c @@ -119,7 +119,7 @@ static int sighandler_backtrace(void) { NULL}; execvp(args[0], args); DLOG("Failed to exec GDB\n"); - exit(1); + exit(EXIT_FAILURE); } int status = 0; diff --git a/src/startup.c b/src/startup.c index 45d4673e..0646d7af 100644 --- a/src/startup.c +++ b/src/startup.c @@ -195,7 +195,7 @@ void start_application(const char *command, bool no_startup_id) { execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, NULL); /* not reached */ } - _exit(0); + _exit(EXIT_SUCCESS); } wait(0); diff --git a/src/util.c b/src/util.c index f0e053be..e9df9575 100644 --- a/src/util.c +++ b/src/util.c @@ -163,7 +163,7 @@ void exec_i3_utility(char *name, char *argv[]) { char buffer[BUFSIZ]; if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) { warn("could not read /proc/self/exe"); - _exit(1); + _exit(EXIT_FAILURE); } dir = dirname(buffer); sasprintf(&migratepath, "%s/%s", dir, name); diff --git a/src/xinerama.c b/src/xinerama.c index 4acfd3cb..efae10dc 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -84,7 +84,7 @@ static void query_screens(xcb_connection_t *conn) { if (num_screens == 0) { ELOG("No screens found. Please fix your setup. i3 will exit now.\n"); - exit(0); + exit(EXIT_SUCCESS); } }