mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
vsh: Allow vshReadlineInit() to be called multiple times
Thing about vshReadlineInit() is - it's called multiple times.
The first time from vshInit(), when @ctl was filled only
partially (most notably, before any argv parsing is done, hence
ctl->imode is set to false). The second time after argv parsing,
from virshInit() -> vshInitReload(). In here, ctl->imode might
have changed and thus vshReadlineInit() can't exit early - it
needs to set up stuff for interactive mode (history basically).
To allow vshReadlineInit() to be called again,
vshReadlineDeinit() must set @autoCompleteOpaque to NULL.
Fixes: cab1e71f01
Resolves: https://issues.redhat.com/browse/RHEL-53560
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
376e0424d8
commit
18fd4899f3
@ -3040,6 +3040,9 @@ vshReadlineDeinit(vshControl *ctl)
|
|||||||
|
|
||||||
g_clear_pointer(&ctl->historydir, g_free);
|
g_clear_pointer(&ctl->historydir, g_free);
|
||||||
g_clear_pointer(&ctl->historyfile, g_free);
|
g_clear_pointer(&ctl->historyfile, g_free);
|
||||||
|
|
||||||
|
/* Allow vshReadlineInit() to be called again. */
|
||||||
|
autoCompleteOpaque = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
Reference in New Issue
Block a user