From db85b2ddc745fb382f33c59ac202ee785494d773 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Fri, 30 Apr 2010 13:28:44 +0000 Subject: [PATCH] Don't run any complex initialisation for the "version" lvm2 command. We can use it even in read-only environment where a try to initialise file-based locking fails (not to mention other processing related with lvm2 init). Simply, we want to output the version only, nothing else. And this should always work. --- tools/lvmcmdline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 48635567a..8fc568062 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1364,6 +1364,10 @@ int lvm2_main(int argc, char **argv) unsetenv("LVM_DID_EXEC"); } + /* "version" command is simple enough so it doesn't need any complex init */ + if (!alias && argc > 1 && !strcmp(argv[1], "version")) + return version(NULL, argc, argv); + if (!(cmd = init_lvm())) return -1; -- 2.43.5