[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/2] qga: flush explicitly when needed
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/2] qga: flush explicitly when needed |
Date: |
Wed, 25 Nov 2015 08:58:11 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 11/25/2015 05:59 AM, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
>
> 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, a write() followed by a read() may lose the
> previously written content, as shown in the following test.
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1210246
> ---
> qga/commands-posix.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
With Laszlo's suggested commit message improvements,
Reviewed-by: Eric Blake <address@hidden>
>
> 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 time_ns,
> Error **errp)
> }
> }
>
> +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?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 0/2] qga: flush explicitly when needed, marcandre . lureau, 2015/11/25
- [Qemu-devel] [PATCH v3 1/2] qga: flush explicitly when needed, marcandre . lureau, 2015/11/25
- [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, marcandre . lureau, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Eric Blake, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Michael Roth, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Eric Blake, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Michael Roth, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Eric Blake, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Michael Roth, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Eric Blake, 2015/11/25
- Re: [Qemu-devel] [PATCH v3 2/2] tests: add file-write-read test, Michael Roth, 2015/11/25
Re: [Qemu-devel] [PATCH v3 0/2] qga: flush explicitly when needed, Michael Roth, 2015/11/25