提交 0217089b 编写于 作者: R Roman Bogorodskiy

virsh: don't override connection URI from argv

Currently, if a connection URI was specified on the command line by the
'-c' switch, virsh connects to it, but after connecting overrides its
value with the one it tries to obtain from the VIRSH_DEFAULT_CONNECT_URI
environment variable.

This makes virsh connecting to the wrong URI if it disconnects from the
hypervisor and then tries to reconnect, and also leaks the original connname.

Fix by calling virGetEnvBlockSUID() before virshParseArgv().
上级 003fa6d6
......@@ -962,14 +962,14 @@ main(int argc, char **argv)
if (!vshInit(ctl, cmdGroups, NULL))
exit(EXIT_FAILURE);
ctl->connname = vshStrdup(ctl, virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"));
if (!virshParseArgv(ctl, argc, argv) ||
!virshInit(ctl)) {
virshDeinit(ctl);
exit(EXIT_FAILURE);
}
ctl->connname = vshStrdup(ctl, virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"));
if (!ctl->imode) {
ret = vshCommandRun(ctl, ctl->cmd);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册