1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tools: Introduce exit code EINIT_FAILED.

Replace -1 (reported as 255) by 4.
This commit is contained in:
Alasdair G Kergon 2017-07-26 23:18:03 +01:00
parent f9f75de3da
commit 54f5bc01b9
4 changed files with 10 additions and 7 deletions

View File

@ -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

View 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. */

View 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 */
/*

View 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;