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 <pavel.dovga...@ispras.ru>
> 
> ---
>  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