mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cleanup: improve previous patch
Make the test earlier, before any dereference of 'argv' pointer.
This commit is contained in:
parent
2d3700ba42
commit
986a50e4a1
@ -1487,6 +1487,9 @@ int lvm2_main(int argc, char **argv)
|
||||
int ret, alias = 0;
|
||||
struct cmd_context *cmd;
|
||||
|
||||
if (!argv)
|
||||
return -1;
|
||||
|
||||
base = last_path_component(argv[0]);
|
||||
if (strcmp(base, "lvm") && strcmp(base, "lvm.static") &&
|
||||
strcmp(base, "initrd-lvm"))
|
||||
@ -1499,7 +1502,7 @@ int lvm2_main(int argc, char **argv)
|
||||
return -1;
|
||||
|
||||
if (is_static() && strcmp(base, "lvm.static") &&
|
||||
path_exists(LVM_SHARED_PATH) && argv &&
|
||||
path_exists(LVM_SHARED_PATH) &&
|
||||
!getenv("LVM_DID_EXEC")) {
|
||||
if (setenv("LVM_DID_EXEC", base, 1))
|
||||
log_sys_error("setenv", "LVM_DID_EXEC");
|
||||
|
Loading…
x
Reference in New Issue
Block a user