qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 21/26] replay: check return values of fwr


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH v2 21/26] replay: check return values of fwrite
Date: Tue, 14 Nov 2017 14:37:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 14/11/2017 09:18, Pavel Dovgalyuk wrote:
> This patch adds error reporting when fwrite cannot completely
> save the buffer to the file.
> 
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> 
> ---
>  replay/replay-internal.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/replay/replay-internal.c b/replay/replay-internal.c
> index a1a7686..1888400 100644
> --- a/replay/replay-internal.c
> +++ b/replay/replay-internal.c
> @@ -62,7 +62,9 @@ void replay_put_array(const uint8_t *buf, size_t size)
>  {
>      if (replay_file) {
>          replay_put_dword(size);
> -        fwrite(buf, 1, size, replay_file);
> +        if (fwrite(buf, 1, size, replay_file) != size) {
> +            error_report("replay write error");
> +        }
>      }
>  }
>  
> 

Should the error be printed only once?  In addition, putc is not tested
in the same way.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]