From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1cSl-0004Mt-Fy for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:58:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1cSi-0000Ki-9b for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:58:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1cSi-0000Kc-4A for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:58:28 -0500 References: <1448456352-14143-1-git-send-email-marcandre.lureau@redhat.com> <1448456352-14143-2-git-send-email-marcandre.lureau@redhat.com> From: Eric Blake Message-ID: <5655DA93.6020008@redhat.com> Date: Wed, 25 Nov 2015 08:58:11 -0700 MIME-Version: 1.0 In-Reply-To: <1448456352-14143-2-git-send-email-marcandre.lureau@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oxucE9iNfR3e9NItOKVAoNWOVUOpDuUKl" Subject: Re: [Qemu-devel] [PATCH v3 1/2] qga: flush explicitly when needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oxucE9iNfR3e9NItOKVAoNWOVUOpDuUKl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/25/2015 05:59 AM, marcandre.lureau@redhat.com wrote: > From: Marc-Andr=C3=A9 Lureau >=20 > According to the specification: > http://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html >=20 > "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." >=20 > Without this change, a write() followed by a read() may lose the > previously written content, as shown in the following test. >=20 > Fixes: > https://bugzilla.redhat.com/show_bug.cgi?id=3D1210246 > --- > qga/commands-posix.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 37 insertions(+) With Laszlo's suggested commit message improvements, Reviewed-by: Eric Blake >=20 > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index 0ebd473..cf1d7ec 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -216,9 +216,16 @@ void qmp_guest_set_time(bool has_time, int64_t tim= e_ns, Error **errp) > } > } > =20 > +typedef enum { > + RW_STATE_NEW, Bikeshedding: NEW really only sounds right after open(), and doesn't quite right after a flush; maybe CLEAN or WAITING would be a better name?= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --oxucE9iNfR3e9NItOKVAoNWOVUOpDuUKl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWVdqTAAoJEKeha0olJ0NqkqsH/Ak8ZB+h71ZuPGpOziLhKcs4 rWjCiIAu2Uw1dBprQiVnUf+ykpm11O8ya0ek3CnBdC1RsC99/aTCuOwzYA+Kpa5n JODAhMlFXpLRuCDRoPeFVu7slWd/eesgh17BwBmoixVkZCkB9BGKpZ90q7YkXldw kuIe8UHi5XbUvyNiP+cpNXAezJ8/8dEh8fiHWYEjp1w5einISgB9Qz1ZwjCGn+sU L0PxlHcvHP7SrQEtrzj3t4u1Ozc1DiEdWjAosnhkG2rLcNJPq6P88QRi9MdzMf9P oOBEP9OkqEyZPVtTSW6TLbAbgsZVaEH5DVG+73FQFKgeJflbyZZ+usxi+1iNL68= =977E -----END PGP SIGNATURE----- --oxucE9iNfR3e9NItOKVAoNWOVUOpDuUKl--