]> git.proxmox.com Git - mirror_corosync-qdevice.git/commitdiff
qdevice: Use EXIT_SUCCESS and EXIT_FAILURE codes
authorJan Friesse <jfriesse@redhat.com>
Wed, 12 Aug 2020 13:31:33 +0000 (15:31 +0200)
committerJan Friesse <jfriesse@redhat.com>
Wed, 12 Aug 2020 13:52:17 +0000 (15:52 +0200)
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
22 files changed:
qdevices/corosync-qdevice-tool.c
qdevices/corosync-qdevice.c
qdevices/corosync-qnetd-tool.c
qdevices/corosync-qnetd.c
qdevices/process-list.c
qdevices/qdevice-cmap.c
qdevices/qdevice-heuristics.c
qdevices/qdevice-instance.c
qdevices/qdevice-ipc-cmd.c
qdevices/qdevice-model.c
qdevices/qdevice-net-algorithm.c
qdevices/qdevice-net-cast-vote-timer.c
qdevices/qdevice-net-heuristics.c
qdevices/qdevice-net-msg-received.c
qdevices/qdevice-net-poll.c
qdevices/qdevice-net-socket.c
qdevices/qdevice-net-votequorum.c
qdevices/qdevice-votequorum.c
qdevices/qnetd-algo-ffsplit.c
qdevices/qnetd-client-msg-received.c
qdevices/qnetd-client-net.c
qdevices/utils.c

index e30730e62a2e3909b8afe1414b09169ce5f69cd6..45a26f871676b07d043691157d81f963ed9584f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -55,7 +55,7 @@ enum qdevice_tool_operation {
 };
 
 enum qdevice_tool_exit_code {
-       QDEVICE_TOOL_EXIT_CODE_NO_ERROR = 0,
+       QDEVICE_TOOL_EXIT_CODE_NO_ERROR = EXIT_SUCCESS,
        QDEVICE_TOOL_EXIT_CODE_USAGE = 1,
        QDEVICE_TOOL_EXIT_CODE_INTERNAL_ERROR = 2,
        QDEVICE_TOOL_EXIT_CODE_SOCKET_CONNECT = 3,
index c63ab8fac578d7fd8ec77c81cb1ce18426e26f21..b322c93574b541714b85f8b0311ad7e217192db1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -118,7 +118,7 @@ cli_parse_long_opt(struct qdevice_advanced_settings *advanced_settings, const ch
 
        dynar_init(&dynar_long_opt, strlen(long_opt) + 1);
        if (dynar_str_cpy(&dynar_long_opt, long_opt) != 0) {
-               errx(1, "Can't alloc memory for long option");
+               errx(EXIT_FAILURE, "Can't alloc memory for long option");
        }
 
        dynar_getopt_lex_init(&lex, &dynar_long_opt);
@@ -130,10 +130,10 @@ cli_parse_long_opt(struct qdevice_advanced_settings *advanced_settings, const ch
                res = qdevice_advanced_settings_set(advanced_settings, opt, val);
                switch (res) {
                case -1:
-                       errx(1, "Unknown option '%s'", opt);
+                       errx(EXIT_FAILURE, "Unknown option '%s'", opt);
                        break;
                case -2:
-                       errx(1, "Invalid value '%s' for option '%s'", val, opt);
+                       errx(EXIT_FAILURE, "Invalid value '%s' for option '%s'", val, opt);
                        break;
                }
        }
@@ -169,7 +169,7 @@ cli_parse(int argc, char * const argv[], int *foreground, int *force_debug, int
                case 'h':
                case '?':
                        usage();
-                       exit(1);
+                       exit(EXIT_FAILURE);
                        break;
                }
        }
@@ -188,7 +188,7 @@ main(int argc, char * const argv[])
        int model_run_res;
 
        if (qdevice_advanced_settings_init(&advanced_settings) != 0) {
-               errx(1, "Can't alloc memory for advanced settings");
+               errx(EXIT_FAILURE, "Can't alloc memory for advanced settings");
        }
 
        cli_parse(argc, argv, &foreground, &force_debug, &bump_log_priority, &advanced_settings);
@@ -200,7 +200,7 @@ main(int argc, char * const argv[])
 
        qdevice_cmap_init(&instance);
        if (qdevice_log_init(&instance, foreground, force_debug, bump_log_priority) == -1) {
-               errx(1, "Can't initialize logging");
+               errx(EXIT_FAILURE, "Can't initialize logging");
        }
 
        /*
@@ -218,7 +218,7 @@ main(int argc, char * const argv[])
                        log_err(LOG_ERR, "Can't acquire lock");
                }
 
-               exit(1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Initializing votequorum");
@@ -226,7 +226,7 @@ main(int argc, char * const argv[])
 
        log(LOG_DEBUG, "Initializing local socket");
        if (qdevice_ipc_init(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Registering qdevice models");
@@ -234,38 +234,38 @@ main(int argc, char * const argv[])
 
        log(LOG_DEBUG, "Configuring qdevice");
        if (qdevice_instance_configure_from_cmap(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Configuring master_wins");
        if (qdevice_votequorum_master_wins(&instance, (advanced_settings.master_wins ==
            QDEVICE_ADVANCED_SETTINGS_MASTER_WINS_FORCE_ON ? 1 : 0)) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Getting configuration node list");
        if (qdevice_cmap_store_config_node_list(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Initializing qdevice model");
        if (qdevice_model_init(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Initializing cmap tracking");
        if (qdevice_cmap_add_track(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Waiting for ring id");
        if (qdevice_votequorum_wait_for_ring_id(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Waiting for initial heuristics exec result");
        if (qdevice_heuristics_wait_for_initial_exec_result(&instance.heuristics_instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        global_instance = &instance;
@@ -303,5 +303,5 @@ main(int argc, char * const argv[])
 
        qdevice_advanced_settings_destroy(&advanced_settings);
 
-       return (model_run_res == 0 ? 0 : 2);
+       return (model_run_res == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index e52d1ce767bd14eb30ae46ecad0f88b8e05240ae..0ffcdd4f9d8375c9b98188b448cba40be10fe90f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -56,7 +56,7 @@ enum qnetd_tool_operation {
 };
 
 enum qnetd_tool_exit_code {
-       QNETD_TOOL_EXIT_CODE_NO_ERROR = 0,
+       QNETD_TOOL_EXIT_CODE_NO_ERROR = EXIT_SUCCESS,
        QNETD_TOOL_EXIT_CODE_USAGE = 1,
        QNETD_TOOL_EXIT_CODE_INTERNAL_ERROR = 2,
        QNETD_TOOL_EXIT_CODE_SOCKET_CONNECT = 3,
index b611293e9c1b66c059c6d4afc91256423749305e..8dc5022b1203b8425c4cdabdd40a028f7c0ee6f5 100644 (file)
@@ -79,7 +79,7 @@ qnetd_err_nss(void)
 
        log_nss(LOG_CRIT, "NSS error");
 
-       exit(1);
+       exit(EXIT_FAILURE);
 }
 
 static void
@@ -212,7 +212,7 @@ cli_parse_long_opt(struct qnetd_advanced_settings *advanced_settings, const char
 
        dynar_init(&dynar_long_opt, strlen(long_opt) + 1);
        if (dynar_str_cpy(&dynar_long_opt, long_opt) != 0) {
-               errx(1, "Can't alloc memory for long option");
+               errx(EXIT_FAILURE, "Can't alloc memory for long option");
        }
 
        dynar_getopt_lex_init(&lex, &dynar_long_opt);
@@ -224,10 +224,10 @@ cli_parse_long_opt(struct qnetd_advanced_settings *advanced_settings, const char
                res = qnetd_advanced_settings_set(advanced_settings, opt, val);
                switch (res) {
                case -1:
-                       errx(1, "Unknown option '%s'", opt);
+                       errx(EXIT_FAILURE, "Unknown option '%s'", opt);
                        break;
                case -2:
-                       errx(1, "Invalid value '%s' for option '%s'", val, opt);
+                       errx(EXIT_FAILURE, "Invalid value '%s' for option '%s'", val, opt);
                        break;
                }
        }
@@ -274,26 +274,26 @@ cli_parse(int argc, char * const argv[], char **host_addr, uint16_t *host_port,
                        break;
                case 'c':
                        if ((*client_cert_required = utils_parse_bool_str(optarg)) == -1) {
-                               errx(1, "client_cert_required should be on/yes/1, off/no/0");
+                               errx(EXIT_FAILURE, "client_cert_required should be on/yes/1, off/no/0");
                        }
                        break;
                case 'l':
                        free(*host_addr);
                        *host_addr = strdup(optarg);
                        if (*host_addr == NULL) {
-                               errx(1, "Can't alloc memory for host addr string");
+                               errx(EXIT_FAILURE, "Can't alloc memory for host addr string");
                        }
                        break;
                case 'm':
                        if (utils_strtonum(optarg, 0, LLONG_MAX, &tmpll) == -1) {
-                               errx(1, "max clients value %s is invalid", optarg);
+                               errx(EXIT_FAILURE, "max clients value %s is invalid", optarg);
                        }
 
                        *max_clients = (size_t)tmpll;
                        break;
                case 'p':
                        if (utils_strtonum(optarg, 1, UINT16_MAX, &tmpll) == -1) {
-                               errx(1, "host port must be in range 1-%u", UINT16_MAX);
+                               errx(EXIT_FAILURE, "host port must be in range 1-%u", UINT16_MAX);
                        }
 
                        *host_port = tmpll;
@@ -309,17 +309,17 @@ cli_parse(int argc, char * const argv[], char **host_addr, uint16_t *host_port,
                        } else if (strcasecmp(optarg, "req") == 0) {
                                *tls_supported = TLV_TLS_REQUIRED;
                        } else {
-                               errx(1, "tls must be one of on, off, req");
+                               errx(EXIT_FAILURE, "tls must be one of on, off, req");
                        }
                        break;
                case 'v':
                        display_version();
-                       exit(1);
+                       exit(EXIT_FAILURE);
                        break;
                case 'h':
                case '?':
                        usage();
-                       exit(1);
+                       exit(EXIT_FAILURE);
                        break;
                }
        }
@@ -345,7 +345,7 @@ main(int argc, char * const argv[])
        int poll_res;
 
        if (qnetd_advanced_settings_init(&advanced_settings) != 0) {
-               errx(1, "Can't alloc memory for advanced settings");
+               errx(EXIT_FAILURE, "Can't alloc memory for advanced settings");
        }
 
        cli_parse(argc, argv, &host_addr, &host_port, &foreground, &debug_log, &bump_log_priority,
@@ -357,7 +357,7 @@ main(int argc, char * const argv[])
        }
 
        if (log_init(QNETD_PROGRAM_NAME, log_target, LOG_DAEMON) == -1) {
-               errx(1, "Can't initialize logging");
+               errx(EXIT_FAILURE, "Can't initialize logging");
        }
 
        log_set_debug(debug_log);
@@ -370,7 +370,7 @@ main(int argc, char * const argv[])
            advanced_settings.nss_db_dir : NULL)) != 0) {
                log_err(LOG_ERR, "Can't open NSS DB directory");
 
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        /*
@@ -388,7 +388,7 @@ main(int argc, char * const argv[])
                        log_err(LOG_ERR, "Can't acquire lock");
                }
 
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Initializing nss");
@@ -404,7 +404,7 @@ main(int argc, char * const argv[])
        if (qnetd_instance_init(&instance, tls_supported, client_cert_required,
            max_clients, &advanced_settings) == -1) {
                log(LOG_ERR, "Can't initialize qnetd");
-               return (1);
+               return (EXIT_FAILURE);
        }
        instance.host_addr = host_addr;
        instance.host_port = host_port;
@@ -415,7 +415,7 @@ main(int argc, char * const argv[])
 
        log(LOG_DEBUG, "Initializing local socket");
        if (qnetd_ipc_init(&instance) != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Creating listening socket");
@@ -442,7 +442,7 @@ main(int argc, char * const argv[])
            &instance, NULL) != 0) {
                log(LOG_ERR, "Can't add server socket to main poll loop");
 
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        global_instance = &instance;
@@ -450,7 +450,7 @@ main(int argc, char * const argv[])
 
        log(LOG_DEBUG, "Registering algorithms");
        if (qnetd_algorithm_register_all() != 0) {
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "QNetd ready to provide service");
@@ -467,7 +467,7 @@ main(int argc, char * const argv[])
 
        if (poll_res == -2) {
                log(LOG_CRIT, "pr_poll_loop_exec returned -2 - internal error");
-               return (1);
+               return (EXIT_FAILURE);
        }
 
        /*
@@ -503,5 +503,5 @@ main(int argc, char * const argv[])
        log(LOG_DEBUG, "Closing log");
        log_close();
 
-       return (0);
+       return (EXIT_SUCCESS);
 }
index 685a59ded2dd4fa002d30f48dec5c34bca21ff4e..26322714e2c45bc109d84ef016aeec6689b52968 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -260,12 +260,12 @@ process_list_entry_exec_helper_set_stdfd(void)
 
        devnull = open("/dev/null", O_RDWR);
        if (devnull == -1) {
-               err(1, "Can't open /dev/null");
+               err(EXIT_FAILURE, "Can't open /dev/null");
        }
 
        if (dup2(devnull, 0) < 0 || dup2(devnull, 1) < 0 || dup2(devnull, 2) < 0) {
                close(devnull);
-               err(1, "Can't dup2 stdin/out/err to /dev/null");
+               err(EXIT_FAILURE, "Can't dup2 stdin/out/err to /dev/null");
        }
 
        close(devnull);
@@ -295,7 +295,7 @@ process_list_entry_exec(const struct process_list *plist, struct process_list_en
                /*
                 * Exec returned -> exec failed
                 */
-               err(1, "Can't execute command %s (%s)", entry->name, entry->exec_argv[0]);
+               err(EXIT_FAILURE, "Can't execute command %s (%s)", entry->name, entry->exec_argv[0]);
        } else {
                entry->pid = pid;
                entry->state = PROCESS_LIST_ENTRY_STATE_RUNNING;
index 9a1e2adc4cda7d09af3443d6efa04a4b403d602d..6a9ba5d96c831b28233cc75a58eb9a298e855e78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -224,11 +224,11 @@ qdevice_cmap_init(struct qdevice_instance *instance)
        }
 
        if (res != CS_OK) {
-               errx(1, "Failed to initialize the cmap API. Error %s", cs_strerror(res));
+               errx(EXIT_FAILURE, "Failed to initialize the cmap API. Error %s", cs_strerror(res));
        }
 
        if ((res = cmap_context_set(instance->cmap_handle, (void *)instance)) != CS_OK) {
-               errx(1, "Can't set cmap context. Error %s", cs_strerror(res));
+               errx(EXIT_FAILURE, "Can't set cmap context. Error %s", cs_strerror(res));
        }
 
        cmap_fd_get(instance->cmap_handle, &instance->cmap_poll_fd);
@@ -247,7 +247,7 @@ qdevice_cmap_node_list_event(struct qdevice_instance *instance)
 
                if (qdevice_model_get_config_node_list_failed(instance) != 0) {
                        log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
-                       exit(2);
+                       exit(EXIT_FAILURE);
                }
 
                return ;
@@ -269,7 +269,7 @@ qdevice_cmap_node_list_event(struct qdevice_instance *instance)
        if (qdevice_model_config_node_list_changed(instance, &nlist,
            config_version_set, config_version) != 0) {
                log(LOG_DEBUG, "qdevice_model_config_node_list_changed returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        node_list_free(&instance->config_node_list);
@@ -280,7 +280,7 @@ qdevice_cmap_node_list_event(struct qdevice_instance *instance)
 
                if (qdevice_model_get_config_node_list_failed(instance) != 0) {
                        log(LOG_DEBUG, "qdevice_model_get_config_node_list_failed returned error -> exit");
-                       exit(2);
+                       exit(EXIT_FAILURE);
                }
 
                return ;
@@ -308,7 +308,7 @@ qdevice_cmap_heuristics_event(struct qdevice_instance *instance)
        log(LOG_DEBUG, "Heuristics configuration possibly changed");
        if (qdevice_instance_configure_from_cmap_heuristics(instance) != 0) {
                log(LOG_DEBUG, "qdevice_instance_configure_from_cmap_heuristics returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 }
 
@@ -333,7 +333,7 @@ qdevice_cmap_reload_cb(cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track
 
        if (cmap_context_get(cmap_handle, (const void **)&instance) != CS_OK) {
                log(LOG_ERR, "Fatal error. Can't get cmap context");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        /*
@@ -394,7 +394,7 @@ qdevice_cmap_reload_cb(cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track
         */
        if (qdevice_model_cmap_changed(instance, &events) != 0) {
                log(LOG_DEBUG, "qdevice_model_cmap_changed returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 }
 
index e98f935883b1f9b6fb2c3c13b841d05d0604e098..4820f9e78933e71fefcbed923e13e480fd86bb04 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -59,42 +59,42 @@ qdevice_heuristics_init(struct qdevice_heuristics_instance *instance,
        pid_t pid;
 
        if (pipe(pipe_cmd_in) != 0) {
-               err(1, "Can't create command input pipe");
+               err(EXIT_FAILURE, "Can't create command input pipe");
        }
 
        if (pipe(pipe_cmd_out) != 0) {
-               err(1, "Can't create command output pipe");
+               err(EXIT_FAILURE, "Can't create command output pipe");
        }
 
        if (pipe(pipe_log_out) != 0) {
-               err(1, "Can't create logging output pipe");
+               err(EXIT_FAILURE, "Can't create logging output pipe");
        }
 
        pid = fork();
        if (pid == -1) {
-               err(1, "Can't create child process");
+               err(EXIT_FAILURE, "Can't create child process");
        } else if (pid == 0) {
                /*
                 * Child
                 */
                (void)setsid();
                if (dup2(pipe_cmd_in[0], 0) == -1) {
-                       err(1, "Can't dup2 command input pipe");
+                       err(EXIT_FAILURE, "Can't dup2 command input pipe");
                }
                close(pipe_cmd_in[1]);
                close(pipe_cmd_in[0]);
                if (utils_fd_set_non_blocking(0) == -1) {
-                       err(1, "Can't set non blocking flag on command input pipe");
+                       err(EXIT_FAILURE, "Can't set non blocking flag on command input pipe");
                }
 
                if (dup2(pipe_cmd_out[1], 1) == -1) {
-                       err(1, "Can't dup2 command output pipe");
+                       err(EXIT_FAILURE, "Can't dup2 command output pipe");
                }
                close(pipe_cmd_out[0]);
                close(pipe_cmd_out[1]);
 
                if (dup2(pipe_log_out[1], 2) == -1) {
-                       err(1, "Can't dup2 logging output pipe");
+                       err(EXIT_FAILURE, "Can't dup2 logging output pipe");
                }
                close(pipe_log_out[0]);
                close(pipe_log_out[1]);
@@ -105,7 +105,7 @@ qdevice_heuristics_init(struct qdevice_heuristics_instance *instance,
 
                qdevice_advanced_settings_destroy(advanced_settings);
 
-               exit(0);
+               exit(EXIT_SUCCESS);
        } else {
                close(pipe_cmd_in[0]);
                close(pipe_cmd_out[1]);
@@ -115,15 +115,15 @@ qdevice_heuristics_init(struct qdevice_heuristics_instance *instance,
 
                instance->pipe_cmd_send = pipe_cmd_in[1];
                if (utils_fd_set_non_blocking(instance->pipe_cmd_send) == -1) {
-                       err(1, "Can't set non blocking flag on command input pipe");
+                       err(EXIT_FAILURE, "Can't set non blocking flag on command input pipe");
                }
                instance->pipe_cmd_recv = pipe_cmd_out[0];
                if (utils_fd_set_non_blocking(instance->pipe_cmd_recv) == -1) {
-                       err(1, "Can't set non blocking flag on command output pipe");
+                       err(EXIT_FAILURE, "Can't set non blocking flag on command output pipe");
                }
                instance->pipe_log_recv = pipe_log_out[0];
                if (utils_fd_set_non_blocking(instance->pipe_cmd_recv) == -1) {
-                       err(1, "Can't set non blocking flag on logging output pipe");
+                       err(EXIT_FAILURE, "Can't set non blocking flag on logging output pipe");
                }
                instance->worker_pid = pid;
 
@@ -311,7 +311,7 @@ qdevice_heuristics_wait_for_initial_exec_result(struct qdevice_heuristics_instan
 
                                        if (!case_processed) {
                                                log(LOG_CRIT, "Unhandled read on poll descriptor %u", i);
-                                               exit(1);
+                                               exit(EXIT_FAILURE);
                                        }
                                }
 
@@ -336,7 +336,7 @@ qdevice_heuristics_wait_for_initial_exec_result(struct qdevice_heuristics_instan
 
                                        if (!case_processed) {
                                                log(LOG_CRIT, "Unhandled write on poll descriptor %u", i);
-                                               exit(1);
+                                               exit(EXIT_FAILURE);
                                        }
                                }
 
index 4fe42de32f0fa4de6767c02eb94813ec6da5cf51..7d750327ed73f7e04f9697618324ac77bfd61491 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -238,7 +238,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
 
        } else {
                log(LOG_CRIT, "Undefined heuristics mode");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (send_exec_list) {
index 09ce2d493e43323e80a19f7c3d4f7afacfc4b5c1..9499c16a86c529c4ed94636e708d9db2dbe85dd7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -160,7 +160,7 @@ qdevice_ipc_cmd_vq_nodestate_to_str(uint32_t state)
        default:
                log(LOG_ERR, "qdevice_ipc_cmd_vq_nodestate_to_str: Unhandled votequorum "
                    "node state %"PRIu32, state);
-               exit(1);
+               exit(EXIT_FAILURE);
                break;
        }
 
index 2cc6725c541f3023e87b7c25bb43c36d2bc5a238..a4167f01d5ed82544f5afb9a8c96ddecefdeb8f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -45,7 +45,7 @@ qdevice_model_init(struct qdevice_instance *instance)
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_init unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->init(instance));
@@ -58,7 +58,7 @@ qdevice_model_destroy(struct qdevice_instance *instance)
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_destroy unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->destroy(instance));
@@ -71,7 +71,7 @@ qdevice_model_run(struct qdevice_instance *instance)
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_run unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->run(instance));
@@ -84,7 +84,7 @@ qdevice_model_get_config_node_list_failed(struct qdevice_instance *instance)
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_run unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->get_config_node_list_failed(instance));
@@ -98,7 +98,7 @@ qdevice_model_config_node_list_changed(struct qdevice_instance *instance,
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_run unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -113,7 +113,7 @@ qdevice_model_votequorum_quorum_notify(struct qdevice_instance *instance,
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_votequorum_quorum_notify unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -128,7 +128,7 @@ qdevice_model_votequorum_node_list_notify(struct qdevice_instance *instance,
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_votequorum_node_list_notify unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -144,7 +144,7 @@ qdevice_model_votequorum_node_list_heuristics_notify(struct qdevice_instance *in
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_votequorum_node_list_heuristics_notify unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -160,7 +160,7 @@ qdevice_model_votequorum_expected_votes_notify(struct qdevice_instance *instance
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_votequorum_expected_votes_notify unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -174,7 +174,7 @@ qdevice_model_ipc_cmd_status(struct qdevice_instance *instance, struct dynar *ou
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_ipc_cmd_status unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -189,7 +189,7 @@ qdevice_model_cmap_changed(struct qdevice_instance *instance,
        if (instance->model_type >= QDEVICE_MODEL_TYPE_ARRAY_SIZE ||
            qdevice_model_array[instance->model_type] == NULL) {
                log(LOG_CRIT, "qdevice_model_cmap_chaged unhandled model");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_model_array[instance->model_type]->
@@ -220,7 +220,7 @@ qdevice_model_register_all(void)
 
        if (qdevice_model_net_register() != 0) {
                log(LOG_CRIT, "Failed to register model 'net' ");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 }
 
index 2d51511e119f6d1dd6f5b7fba7d74d20bf17f302..4a09f76ef84f5ef3d1fbfce9439bea033fff70ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -52,7 +52,7 @@ qdevice_net_algorithm_init(struct qdevice_net_instance *instance)
        if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_init unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->init(instance));
@@ -66,7 +66,7 @@ qdevice_net_algorithm_connected(struct qdevice_net_instance *instance, enum tlv_
        if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->connected(instance,
@@ -82,7 +82,7 @@ qdevice_net_algorithm_config_node_list_changed(struct qdevice_net_instance *inst
        if (instance->decision_algorithm >= QDEVICE_NET_STATIC_SUPPORTED_DECISION_ALGORITHMS_SIZE ||
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_connected unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -100,7 +100,7 @@ qdevice_net_algorithm_votequorum_node_list_notify(struct qdevice_net_instance *i
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_notify "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->votequorum_node_list_notify(
@@ -117,7 +117,7 @@ qdevice_net_algorithm_votequorum_node_list_heuristics_notify(struct qdevice_net_
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_votequorum_node_list_heuristics_notify "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -135,7 +135,7 @@ qdevice_net_algorithm_votequorum_quorum_notify(struct qdevice_net_instance *inst
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_votequorum_quorum_notify "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -152,7 +152,7 @@ qdevice_net_algorithm_votequorum_expected_votes_notify(struct qdevice_net_instan
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_votequorum_expected_votes_notify "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -169,7 +169,7 @@ qdevice_net_algorithm_config_node_list_reply_received(struct qdevice_net_instanc
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_config_node_list_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -186,7 +186,7 @@ qdevice_net_algorithm_membership_node_list_reply_received(struct qdevice_net_ins
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_membership_node_list_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -204,7 +204,7 @@ qdevice_net_algorithm_quorum_node_list_reply_received(struct qdevice_net_instanc
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_quorum_node_list_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -222,7 +222,7 @@ qdevice_net_algorithm_ask_for_vote_reply_received(struct qdevice_net_instance *i
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_ask_for_vote_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -239,7 +239,7 @@ qdevice_net_algorithm_vote_info_received(struct qdevice_net_instance *instance,
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_vote_info_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -255,7 +255,7 @@ qdevice_net_algorithm_echo_reply_received(struct qdevice_net_instance *instance,
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -270,7 +270,7 @@ qdevice_net_algorithm_echo_reply_not_received(struct qdevice_net_instance *insta
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_echo_reply_not_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -286,7 +286,7 @@ qdevice_net_algorithm_heuristics_change(struct qdevice_net_instance *instance,
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -303,7 +303,7 @@ qdevice_net_algorithm_heuristics_change_reply_received(struct qdevice_net_instan
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_heuristics_change_reply_received "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -320,7 +320,7 @@ qdevice_net_algorithm_disconnected(struct qdevice_net_instance *instance,
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_disconnected "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
@@ -335,7 +335,7 @@ qdevice_net_algorithm_destroy(struct qdevice_net_instance *instance)
            qdevice_net_algorithm_array[instance->decision_algorithm] == NULL) {
                log(LOG_CRIT, "qdevice_net_algorithm_destroy "
                    "unhandled decision algorithm");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (qdevice_net_algorithm_array[instance->decision_algorithm]->
index 2eddfbe959e137a46fa72f8322d97db7251f18fc..b5d20de1d9d8fe61ae22af31e2fadaa4dd62d3e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -78,7 +78,7 @@ qdevice_net_cast_vote_timer_callback(void *data1, void *data2)
        if (!case_processed) {
                log(LOG_CRIT, "qdevice_net_timer_cast_vote: Unhandled cast_vote_timer_vote %u\n",
                    instance->cast_vote_timer_vote);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (qdevice_votequorum_poll(instance->qdevice_instance_ptr, cast_vote) != 0) {
@@ -129,7 +129,7 @@ qdevice_net_cast_vote_timer_update(struct qdevice_net_instance *instance, enum t
        if (!case_processed) {
                log(LOG_CRIT, "qdevice_net_cast_vote_timer_update_vote: Unhandled vote parameter %u\n",
                    vote);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        instance->cast_vote_timer_vote = vote;
index 1230053be107fe7f5db585886d1dd7f628addf23..0f39e992a29281d436901757b535ad675e3419ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 Red Hat, Inc.
+ * Copyright (c) 2017-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -52,7 +52,7 @@ qdevice_net_heuristics_exec_result_to_tlv(enum qdevice_heuristics_exec_result ex
                log(LOG_ERR, "qdevice_net_heuristics_exec_result_to_tlv: Unhandled "
                    "heuristics exec result %s",
                    qdevice_heuristics_exec_result_to_str(exec_result));
-               exit(1);
+               exit(EXIT_FAILURE);
                break;
        }
 
index 27a0c10ab45f48a53ffaf224e777a408ac630195..4d923e14753eca18f8d7a58f7b0421c7a602c806 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -558,7 +558,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
        if (str == NULL) {
                log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
                    "Unhandled node_list_type (debug output)");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Received %s node list reply", str);
@@ -607,7 +607,7 @@ qdevice_net_msg_received_node_list_reply(struct qdevice_net_instance *instance,
        if (!case_processed) {
                log(LOG_CRIT, "qdevice_net_msg_received_node_list_reply fatal error. "
                    "Unhandled node_list_type (algorithm call)");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (res != 0) {
index b9e0e87023a4252b45557b894ae0473c90e493e6..893c4bf18ea96289c9e4d13a1392903b69b2a8a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -114,7 +114,7 @@ qdevice_net_poll_write_socket(struct qdevice_net_instance *instance, const PRPol
                        }
                } else {
                        log(LOG_CRIT, "Unhandled nss_sock_non_blocking_client_succeeded");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
        } else {
                if (qdevice_net_socket_write(instance) == -1) {
@@ -404,7 +404,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 
                                if (!case_processed) {
                                        log(LOG_CRIT, "Unhandled read on poll descriptor %zu", i);
-                                       exit(1);
+                                       exit(EXIT_FAILURE);
                                }
                        }
 
@@ -442,7 +442,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 
                                if (!case_processed) {
                                        log(LOG_CRIT, "Unhandled write on poll descriptor %zu", i);
-                                       exit(1);
+                                       exit(EXIT_FAILURE);
                                }
                        }
 
@@ -461,7 +461,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
                                        if (pfds[i].out_flags != PR_POLL_NVAL) {
                                                log(LOG_CRIT, "POLLERR (%u) on local socket",
                                                    pfds[i].out_flags);
-                                               exit(1);
+                                               exit(EXIT_FAILURE);
                                        } else {
                                                log(LOG_DEBUG, "Local socket is closed");
                                                instance->schedule_disconnect = 1;
@@ -512,7 +512,7 @@ qdevice_net_poll(struct qdevice_net_instance *instance)
 
                                if (!case_processed) {
                                        log(LOG_CRIT, "Unhandled error on poll descriptor %zu", i);
-                                       exit(1);
+                                       exit(EXIT_FAILURE);
                                }
                        }
 
index be407239b8884b8da1c0b496c8d44c54d634a17b..afd851c7caeb705e2cdc42445f2eb12d9d1a782d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -114,7 +114,7 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
                        }
                } else {
                        log(LOG_CRIT, "net_socket_read in skipping msg state");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
 
                instance->skipping_msg = 0;
@@ -123,7 +123,7 @@ qdevice_net_socket_read(struct qdevice_net_instance *instance)
                break;
        default:
                log(LOG_CRIT, "qdevice_net_socket_read unhandled error %d", res);
-               exit(1);
+               exit(EXIT_FAILURE);
                break;
        }
 
index 901a8e980d16573ed1b04ebc4417994c5a6f8661..4ef13facee397c77d91251c8aabb8bd63e6e1947 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -47,7 +47,7 @@ qdevice_net_votequorum_node_state_to_tlv(uint32_t votequorum_node_state)
        default:
                log(LOG_ERR, "qdevice_net_votequorum_node_state_to_tlv: Unhandled votequorum "
                    "node state %"PRIu32, votequorum_node_state);
-               exit(1);
+               exit(EXIT_FAILURE);
                break;
        }
 
index 6bc3e55d340d271ce19ec46237fce480a7cc3735..bd3eee5cdd99ae500877d577d89c9c1ebc0ac41c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -50,7 +50,7 @@ qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle,
 
        if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
                log(LOG_CRIT, "Fatal error. Can't get votequorum context");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        instance->sync_in_progress = 0;
@@ -67,7 +67,7 @@ qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle,
        if (qdevice_model_votequorum_quorum_notify(instance, quorate, node_list_entries,
            node_list) != 0) {
                log(LOG_DEBUG, "qdevice_model_votequorum_quorum_notify returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        instance->vq_quorum_quorate = quorate;
@@ -77,7 +77,7 @@ qdevice_votequorum_quorum_notify_callback(votequorum_handle_t votequorum_handle,
        instance->vq_quorum_node_list = malloc(sizeof(*node_list) * node_list_entries);
        if (instance->vq_quorum_node_list == NULL) {
                log(LOG_CRIT, "Can't alloc votequorum node list memory");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        memcpy(instance->vq_quorum_node_list, node_list, sizeof(*node_list) * node_list_entries);
 }
@@ -97,7 +97,7 @@ qdevice_votequorum_heuristics_exec_result_callback(
            &instance->heuristics_instance.exec_result_notifier_list,
            qdevice_votequorum_heuristics_exec_result_callback, 0) != 0) {
                log(LOG_CRIT, "Can't deactivate votequrorum heuristics exec callback notifier");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Votequorum heuristics exec result callback:");
@@ -107,7 +107,7 @@ qdevice_votequorum_heuristics_exec_result_callback(
        if (qdevice_model_votequorum_node_list_heuristics_notify(instance, instance->vq_node_list_ring_id,
            instance->vq_node_list_entries, instance->vq_node_list, exec_result) != 0) {
                log(LOG_DEBUG, "qdevice_votequorum_node_list_heuristics_notify_callback returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        instance->vq_node_list_initial_heuristics_finished = 1;
@@ -126,7 +126,7 @@ qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_hand
 
        if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
                log(LOG_CRIT, "Fatal error. Can't get votequorum context");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        instance->sync_in_progress = 1;
@@ -145,19 +145,19 @@ qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_hand
        if (qdevice_model_votequorum_node_list_notify(instance, votequorum_ring_id, node_list_entries,
            node_list) != 0) {
                log(LOG_DEBUG, "qdevice_votequorum_node_list_notify_callback returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        if (qdevice_heuristics_result_notifier_list_set_active(
            &instance->heuristics_instance.exec_result_notifier_list,
            qdevice_votequorum_heuristics_exec_result_callback, 1) != 0) {
                log(LOG_CRIT, "Can't activate votequrorum heuristics exec callback notifier");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        if (qdevice_heuristics_exec(&instance->heuristics_instance, instance->sync_in_progress) != 0) {
                log(LOG_CRIT, "Can't start heuristics -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        instance->vq_node_list_initial_ring_id_set = 1;
@@ -167,7 +167,7 @@ qdevice_votequorum_node_list_notify_callback(votequorum_handle_t votequorum_hand
        instance->vq_node_list = malloc(sizeof(*node_list) * node_list_entries);
        if (instance->vq_node_list == NULL) {
                log(LOG_CRIT, "Can't alloc votequorum node list memory");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        memcpy(instance->vq_node_list, node_list, sizeof(*node_list) * node_list_entries);
 }
@@ -180,7 +180,7 @@ qdevice_votequorum_expected_votes_notify_callback(votequorum_handle_t votequorum
 
        if (votequorum_context_get(votequorum_handle, (void **)&instance) != CS_OK) {
                log(LOG_CRIT, "Fatal error. Can't get votequorum context");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        log(LOG_DEBUG, "Votequorum expected_votes notify callback:");
@@ -188,7 +188,7 @@ qdevice_votequorum_expected_votes_notify_callback(votequorum_handle_t votequorum
 
        if (qdevice_model_votequorum_expected_votes_notify(instance, expected_votes) != 0) {
                log(LOG_DEBUG, "qdevice_votequorum_expected_votes_notify_callback returned error -> exit");
-               exit(2);
+               exit(EXIT_FAILURE);
        }
 
        instance->vq_expected_votes = expected_votes;
@@ -224,24 +224,24 @@ qdevice_votequorum_init(struct qdevice_instance *instance)
 
        if (res != CS_OK) {
                log(LOG_CRIT, "Failed to initialize the votequorum API. Error %s", cs_strerror(res));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if ((res = votequorum_qdevice_register(votequorum_handle,
            instance->advanced_settings->votequorum_device_name)) != CS_OK) {
                log(LOG_CRIT, "Can't register votequorum device. Error %s", cs_strerror(res));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if ((res = votequorum_context_set(votequorum_handle, (void *)instance)) != CS_OK) {
                log(LOG_CRIT, "Can't set votequorum context. Error %s", cs_strerror(res));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if ((res = votequorum_getinfo(votequorum_handle, VOTEQUORUM_QDEVICE_NODEID,
            &vq_info)) != CS_OK) {
                log(LOG_CRIT, "Can't get votequorum information. Error %s", cs_strerror(res));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        instance->vq_expected_votes = vq_info.node_expected_votes;
 
@@ -253,13 +253,13 @@ qdevice_votequorum_init(struct qdevice_instance *instance)
            CS_TRACK_CHANGES)) != CS_OK) {
                log(LOG_CRIT, "Can't start tracking votequorum changes. Error %s",
                    cs_strerror(res));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (qdevice_heuristics_result_notifier_list_add(&instance->heuristics_instance.exec_result_notifier_list,
            qdevice_votequorum_heuristics_exec_result_callback) == NULL) {
                log(LOG_CRIT, "Can't add votequrorum heuristics exec callback into notifier");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 }
 
index 6088144c6596360287dc51351c77714ed1a6bd61..d6f01f4fb089291bfc9c53606bb0cc2c4cd4147b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -147,7 +147,7 @@ qnetd_algo_ffsplit_is_preferred_partition(const struct qnetd_client *client,
        if (!case_processed) {
                log(LOG_CRIT, "qnetd_algo_ffsplit_is_preferred_partition unprocessed "
                    "tie_breaker.mode");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        return (node_list_find_node_id(membership_node_list, preferred_node_id) != NULL);
@@ -422,7 +422,7 @@ qnetd_algo_ffsplit_partition_cmp(const struct qnetd_client *client1,
 exit_res:
        if (res == -1) {
                log(LOG_CRIT, "qnetd_algo_ffsplit_partition_cmp unhandled case");
-               exit(1);
+               exit(EXIT_FAILURE);
                /* NOTREACHED */
        }
 
index 84b68665c6e548bc5e2eddde5ed77ec745c90c8c..5bb89a127c7b8d0e80d340e1bcd63baff53ac341 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2019 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -95,7 +95,7 @@ qnetd_client_msg_received_check_tls(struct qnetd_instance *instance, struct qnet
 
        if (!case_processed) {
                log(LOG_ERR, "Unhandled instance tls supported %u", instance->tls_supported);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (tls_required && !client->tls_started) {
@@ -756,7 +756,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet
        if (!case_processed) {
                log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. "
                    "Unhandled node_list_type");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if (reply_error_code != TLV_REPLY_ERROR_CODE_NO_ERROR) {
@@ -824,7 +824,7 @@ qnetd_client_msg_received_node_list(struct qnetd_instance *instance, struct qnet
        if (!case_processed) {
                log(LOG_ERR, "qnetd_client_msg_received_node_list fatal error. "
                    "Unhandled node_list_type");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        /*
index f25c64e757c4a3f0f13f06edd544e187dd61055a..2be5e0fac9ae22e661225de51b0b95c94cc8bc01 100644 (file)
@@ -244,7 +244,7 @@ qnetd_client_net_read(struct qnetd_instance *instance, struct qnetd_client *clie
                break;
        default:
                log(LOG_ERR, "Unhandled msgio_read error %d\n", res);
-               exit(1);
+               exit(EXIT_FAILURE);
                break;
        }
 
index aba921c33d21a8803dc122a566d40538944b5645..bda3b6a1d9cbf629a1535b3c3472f1460ef3d94e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -160,12 +160,12 @@ utils_tty_detach(void)
 
        switch (fork()) {
                case -1:
-                       err(1, "Can't create child process");
+                       err(EXIT_FAILURE, "Can't create child process");
                        break;
                case 0:
                        break;
                default:
-                       exit(0);
+                       exit(EXIT_SUCCESS);
                        break;
        }
 
@@ -177,13 +177,13 @@ utils_tty_detach(void)
         */
        devnull = open("/dev/null", O_RDWR);
        if (devnull == -1) {
-               err(1, "Can't open /dev/null");
+               err(EXIT_FAILURE, "Can't open /dev/null");
        }
 
        if (dup2(devnull, 0) < 0 || dup2(devnull, 1) < 0
            || dup2(devnull, 2) < 0) {
                close(devnull);
-               err(1, "Can't dup2 stdin/out/err to /dev/null");
+               err(EXIT_FAILURE, "Can't dup2 stdin/out/err to /dev/null");
        }
        close(devnull);
 }