mirror of
https://github.com/libvirt/libvirt.git
synced 2026-07-31 16:48:21 -05:00
virsh: fix entering interactive session
When entering an interactive session, that is, without a command
specified:
virsh --connect $URI
virsh currently segfaults because it tries to access
ctl->cmd->def->handler and the ctl->cmd is NULL.
Fix by checking if ctl->cmd is not NULL before doing further checks.
Fixes: b489eb8d6b
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
+1
-1
@@ -126,7 +126,7 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly)
|
||||
virErrorPtr err;
|
||||
virConnectAuthPtr auth = virConnectAuthPtrDefault;
|
||||
|
||||
if (ctl->cmd->def->handler == cmdComplete) {
|
||||
if (ctl->cmd && ctl->cmd->def->handler == cmdComplete) {
|
||||
/* When running from a bash completer we need to avoid any kind of
|
||||
* keyboard input (e.g. ssh asking for a password). To achieve
|
||||
* this, provide no authentication callbacks. */
|
||||
|
||||
Reference in New Issue
Block a user