]> Git Repo - qemu.git/commit - qga/commands-posix.c
qga: flush explicitly when needed
authorMarc-André Lureau <[email protected]>
Wed, 25 Nov 2015 12:59:11 +0000 (13:59 +0100)
committerMichael Roth <[email protected]>
Wed, 25 Nov 2015 23:56:31 +0000 (17:56 -0600)
commit895b00f62a7e86724dc7352d67c7808d37366130
tree4262acf90a4eb9aca73245062014b5869f5b109e
parentf2b608ab80a336b0136d35d9b49419a917656d44
qga: flush explicitly when needed

According to the specification:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html

"the application shall ensure that output is not directly followed by
input without an intervening call to fflush() or to a file positioning
function (fseek(), fsetpos(), or rewind()), and input is not directly
followed by output without an intervening call to a file positioning
function, unless the input operation encounters end-of-file."

Without this change, an fwrite() followed by an fread() may lose the
previously written content, as shown in the following test.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1210246

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
* don't confuse {write,read}() with f{write,read}() in
  commit msg (Laszlo)
Signed-off-by: Michael Roth <[email protected]>
qga/commands-posix.c
This page took 0.024074 seconds and 4 git commands to generate.