]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vsh: Allow vshReadlineInit() to be called multiple times
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 8 Aug 2024 12:21:20 +0000 (14:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 8 Aug 2024 13:45:37 +0000 (15:45 +0200)
commit18fd4899f3ddd8873842ab24cf39bf51b1bf3a02
tree1ee832127b60fc18d375fa7413146555a2acbf50
parent376e0424d8575f37a9f47f9e598129018097e0d5
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: cab1e71f0161fd24c5d6ff4c379d3a242ea8c2d9
Resolves: https://issues.redhat.com/browse/RHEL-53560
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
tools/vsh.c