1
0
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:
Zdenek Kabelac 2013-04-29 13:50:26 +02:00
parent 2d3700ba42
commit 986a50e4a1

View File

@ -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");