From: Peter Rajnoha Date: Fri, 30 Apr 2010 13:28:44 +0000 (+0000) Subject: Don't run any complex initialisation for the "version" lvm2 command. X-Git-Tag: v2_02_91~1983 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5ff4274f9bb6efdbd533d3f7c7927dc1e98e0684;p=lvm2.git 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. --- 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;