mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
vshReadlineInit: Initialize only once
'vshReadlineInit' is called when interactive virsh is started but also on each call to 'cmdComplete'. Calling it repeatedly (using the 'complete' command interactively, or multiple times in batch mode) leaks the buffers for history file configuration. Avoid multiple setups of this function by returning success in case the history file config is already present. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
41400ac1dd
commit
dbf7b727fb
@ -2908,6 +2908,10 @@ vshReadlineInit(vshControl *ctl)
|
||||
const char *break_characters = " \t\n`@$><=;|&{(";
|
||||
const char *quote_characters = "\"'";
|
||||
|
||||
/* initialize readline stuff only once */
|
||||
if (ctl->historydir)
|
||||
return 0;
|
||||
|
||||
/* Opaque data for autocomplete callbacks. */
|
||||
autoCompleteOpaque = ctl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user