]> sourceware.org Git - lvm2.git/commitdiff
tools: Introduce exit code EINIT_FAILED.
authorAlasdair G Kergon <agk@redhat.com>
Wed, 26 Jul 2017 22:18:03 +0000 (23:18 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Wed, 26 Jul 2017 22:18:03 +0000 (23:18 +0100)
Replace -1 (reported as 255) by 4.

WHATS_NEW
tools/errors.h
tools/lvm2cmd.h
tools/lvmcmdline.c

index a9b3a084c7770a750ccf9be8d633fc4172e29122..20da268a23328f4f3d0a552f8cab09843997f211 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.174 - 
 =================================
+  Introduce exit code 4 EINIT_FAILED to replace -1 when initialisation fails.
   Add synchronization points with udev during reshape of raid LVs.
 
 Version 2.02.173 - 20th July 2017
index bfc0461bfed5ddf1f658e40e86c90d24d1b4f68c..3d87a4861070d09651695670ce7fbb88906d7da3 100644 (file)
@@ -19,6 +19,7 @@
 #define ECMD_PROCESSED         1
 #define ENO_SUCH_CMD           2
 #define EINVALID_CMD_LINE      3
+#define EINIT_FAILED           4
 #define ECMD_FAILED            5
 
 /* FIXME Also returned by cmdlib. */
index 2966ec94466331c6fa05e01dd36fe50c2491cd84..cd2e0ec9d2bd56a7538d04b6a0a1dd701898d7a7 100644 (file)
@@ -40,6 +40,7 @@ typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
 #define LVM2_COMMAND_SUCCEEDED 1       /* ECMD_PROCESSED */
 #define LVM2_NO_SUCH_COMMAND   2       /* ENO_SUCH_CMD */
 #define LVM2_INVALID_PARAMETERS        3       /* EINVALID_CMD_LINE */
+#define LVM2_INIT_FAILED       4       /* EINIT_FAILED */
 #define LVM2_PROCESSING_FAILED 5       /* ECMD_FAILED */
 
 /*
index ae55e1239d5d7ad55a35cd54371d8eec186aab2b..81cc5e0d304a6d47a6f70b6802564dd8f7c6e112 100644 (file)
@@ -3420,7 +3420,7 @@ int lvm2_main(int argc, char **argv)
        const char *run_command_name = NULL;
 
        if (!argv)
-               return -1;
+               return EINIT_FAILED;
 
        base = last_path_component(argv[0]);
        if (strcmp(base, "lvm") && strcmp(base, "lvm.static") &&
@@ -3428,16 +3428,16 @@ int lvm2_main(int argc, char **argv)
                alias = 1;
 
        if (!_check_standard_fds())
-               return -1;
+               return EINIT_FAILED;
 
        if (!_get_custom_fds(&custom_fds))
-               return -1;
+               return EINIT_FAILED;
 
        if (!_close_stray_fds(base, &custom_fds))
-               return -1;
+               return EINIT_FAILED;
 
        if (!init_custom_log_streams(&custom_fds))
-               return -1;
+               return EINIT_FAILED;
 
        if (is_static() && strcmp(base, "lvm.static") &&
            path_exists(LVM_PATH) &&
@@ -3461,12 +3461,12 @@ int lvm2_main(int argc, char **argv)
 
                if (*argv[1] == '-') {
                        log_error("Specify options after a command: lvm [command] [options].");
-                       return -1;
+                       return EINVALID_CMD_LINE;
                }
        }
 
        if (!(cmd = init_lvm(0, 0)))
-               return -1;
+               return EINIT_FAILED;
 
        /* Store original argv location so we may customise it if we become a daemon */
        cmd->argv = argv;
This page took 0.050397 seconds and 5 git commands to generate.