Use EXIT_SUCCESS/FAILURE instead of 0/1

This commit is contained in:
Orestis Floros 2020-01-16 09:21:27 +01:00
parent f7aee6b908
commit 0ed94fc788
No known key found for this signature in database
GPG Key ID: 859B90B34AEC1728
10 changed files with 12 additions and 12 deletions

View File

@ -1582,7 +1582,7 @@ void cmd_layout_toggle(I3_CMD, const char *toggle_mode) {
*/ */
void cmd_exit(I3_CMD) { void cmd_exit(I3_CMD) {
LOG("Exiting due to user command.\n"); LOG("Exiting due to user command.\n");
exit(0); exit(EXIT_SUCCESS);
/* unreached */ /* unreached */
} }

View File

@ -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 " fprintf(stderr, "BUG: commands_parser stack full. This means either a bug "
"in the code, or a new command which contains more than " "in the code, or a new command which contains more than "
"10 identified tokens.\n"); "10 identified tokens.\n");
exit(1); exit(EXIT_FAILURE);
} }
// TODO move to a common util // 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 " fprintf(stderr, "BUG: commands_parser stack full. This means either a bug "
"in the code, or a new command which contains more than " "in the code, or a new command which contains more than "
"10 identified tokens.\n"); "10 identified tokens.\n");
exit(1); exit(EXIT_FAILURE);
} }
// TODO move to a common util // TODO move to a common util

View File

@ -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 " fprintf(stderr, "BUG: config_parser stack full. This means either a bug "
"in the code, or a new command which contains more than " "in the code, or a new command which contains more than "
"10 identified tokens.\n"); "10 identified tokens.\n");
exit(1); exit(EXIT_FAILURE);
} }
static void push_long(const char *identifier, long num) { 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 " fprintf(stderr, "BUG: config_parser stack full. This means either a bug "
"in the code, or a new command which contains more than " "in the code, or a new command which contains more than "
"10 identified tokens.\n"); "10 identified tokens.\n");
exit(1); exit(EXIT_FAILURE);
} }
static const char *get_string(const char *identifier) { static const char *get_string(const char *identifier) {

View File

@ -82,6 +82,6 @@ void fake_outputs_init(const char *output_spec) {
if (num_screens == 0) { if (num_screens == 0) {
ELOG("No screens found. Please fix your setup. i3 will exit now.\n"); ELOG("No screens found. Please fix your setup. i3 will exit now.\n");
exit(0); exit(EXIT_FAILURE);
} }
} }

View File

@ -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); xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(conn, cookie, NULL);
if (reply == NULL) { if (reply == NULL) {
ELOG("Could not get geometry of the root window, exiting\n"); 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); DLOG("root geometry reply: (%d, %d) %d x %d\n", reply->x, reply->y, reply->width, reply->height);

View File

@ -434,7 +434,7 @@ int main(int argc, char *argv[]) {
} }
if (only_check_config) { 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 /* If the user passes more arguments, we act like i3-msg would: Just send

View File

@ -119,7 +119,7 @@ static int sighandler_backtrace(void) {
NULL}; NULL};
execvp(args[0], args); execvp(args[0], args);
DLOG("Failed to exec GDB\n"); DLOG("Failed to exec GDB\n");
exit(1); exit(EXIT_FAILURE);
} }
int status = 0; int status = 0;

View File

@ -195,7 +195,7 @@ void start_application(const char *command, bool no_startup_id) {
execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, NULL); execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, NULL);
/* not reached */ /* not reached */
} }
_exit(0); _exit(EXIT_SUCCESS);
} }
wait(0); wait(0);

View File

@ -163,7 +163,7 @@ void exec_i3_utility(char *name, char *argv[]) {
char buffer[BUFSIZ]; char buffer[BUFSIZ];
if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) { if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) {
warn("could not read /proc/self/exe"); warn("could not read /proc/self/exe");
_exit(1); _exit(EXIT_FAILURE);
} }
dir = dirname(buffer); dir = dirname(buffer);
sasprintf(&migratepath, "%s/%s", dir, name); sasprintf(&migratepath, "%s/%s", dir, name);

View File

@ -84,7 +84,7 @@ static void query_screens(xcb_connection_t *conn) {
if (num_screens == 0) { if (num_screens == 0) {
ELOG("No screens found. Please fix your setup. i3 will exit now.\n"); ELOG("No screens found. Please fix your setup. i3 will exit now.\n");
exit(0); exit(EXIT_SUCCESS);
} }
} }