]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: fflush(stdout) after fputs()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 9 Mar 2022 13:01:49 +0000 (14:01 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 10 Mar 2022 07:57:31 +0000 (08:57 +0100)
commit79c613ec8a76e2efd888ad0e73fabd7b97b87116
treeeb6c68f4be083ea28534df2a60034ee820a6a2d2
parenta5e659f071ae5f5fc9aadb46ad7c31736425f8cf
virsh: fflush(stdout) after fputs()

We are not guaranteed that the string we are printing onto stdout
contains '\n' and thus that the stdout is flushed. In fact, I've
met this problem when virsh asked me whether I want to edit the
domain XML again (vshAskReedit()) but the prompt wasn't displayed
(as it does not contain a newline character) and virsh just sat
there waiting for my input, I sat there waiting for virsh's
output. Flush stdout after all fputs()-s  which do not flush
stdout.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/vsh.c