Check the return value of blk_write() and log an error if any
Fixes: Coverity CID 1412799 (Error handling issues)
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <
20200210132252.381343-1-laurent@vivier.eu>
#include "hw/qdev-properties.h"
#include "sysemu/block-backend.h"
#include "trace.h"
#include "hw/qdev-properties.h"
#include "sysemu/block-backend.h"
#include "trace.h"
/*
* VIAs: There are two in every machine,
/*
* VIAs: There are two in every machine,
static void pram_update(MacVIAState *m)
{
if (m->blk) {
static void pram_update(MacVIAState *m)
{
if (m->blk) {
- blk_pwrite(m->blk, 0, m->mos6522_via1.PRAM,
- sizeof(m->mos6522_via1.PRAM), 0);
+ if (blk_pwrite(m->blk, 0, m->mos6522_via1.PRAM,
+ sizeof(m->mos6522_via1.PRAM), 0) < 0) {
+ qemu_log("pram_update: cannot write to file\n");
+ }