]> git.proxmox.com Git - mirror_qemu.git/commit
qemu-img: Flush stdout before before potential stderr messages
authorEric Blake <eblake@redhat.com>
Mon, 6 Jul 2020 20:39:45 +0000 (15:39 -0500)
committerKevin Wolf <kwolf@redhat.com>
Tue, 14 Jul 2020 13:18:59 +0000 (15:18 +0200)
commit4e2f4418784da09cb106264340241856cd2846df
treef76b995a6d8248b4a8be9b337b802b12d88bca01
parentffa244c84a1a30dff69ecc80b0137a2b6d428ecb
qemu-img: Flush stdout before before potential stderr messages

During 'qemu-img create ... 2>&1', if --quiet is not in force, we can
end up with buffered I/O in stdout that was produced before failure,
but which appears in output after failure.  This is confusing; the fix
is to flush stdout prior to attempting anything that might produce an
error message.  Several iotests demonstrate the resulting ordering
change now that the merged outputs now reflect chronology.  (An even
better fix would be to avoid printf from within block.c altogether,
but that's much more invasive...)

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200706203954.341758-2-eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
tests/qemu-iotests/049.out
tests/qemu-iotests/054.out
tests/qemu-iotests/079.out
tests/qemu-iotests/112.out
tests/qemu-iotests/259.out
tests/qemu-iotests/282.out