1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

commands: initialize commands[] once

When using liblvm2cmd, a process can do multiple
init/exit calls, i.e.

lvm2_init(); lvm2_run(); lvm2_exit();
lvm2_init(); lvm2_run(); lvm2_exit();
...

define_commands() needs to set up the global commands[]
definitions only the first time.
This commit is contained in:
David Teigland 2017-02-16 13:59:52 -06:00
parent 15f51bc421
commit 1cb95fa5a0

View File

@ -1130,6 +1130,10 @@ void lvm_register_commands(char *name)
{
int i;
/* already initialized */
if (_cmdline.commands)
return;
memset(&commands, 0, sizeof(commands));
/*