]> sourceware.org Git - lvm2.git/commitdiff
Don't run any complex initialisation for the "version" lvm2 command.
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 30 Apr 2010 13:28:44 +0000 (13:28 +0000)
committerPeter Rajnoha <prajnoha@redhat.com>
Fri, 30 Apr 2010 13:28:44 +0000 (13:28 +0000)
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

index 48635567a73e6800a0b85a2e71c2523d8aff45d3..8fc568062516443aa34d13ea2eb2a28cce4cabd7 100644 (file)
@@ -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;
 
This page took 0.04197 seconds and 5 git commands to generate.