From: Markus Armbruster Date: Mon, 6 Mar 2017 19:00:37 +0000 (+0100) Subject: sheepdog: Fix error handling sd_create() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=48d7c4af06393b974b0a515ac9d1cc7346dbae23;p=qemu.git sheepdog: Fix error handling sd_create() As a bdrv_create() method, sd_create() must set an error and return negative errno on failure. It prints the error instead of setting it when connect_to_sdog() fails. Fix that. While there, return the value of connect_to_sdog() like we do elsewhere, instead of -EIO. No functional change, as connect_to_sdog() returns no other error code. Many more suspicious uses of error_report() and error_report_err() remain in other functions. Left for another day. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- diff --git a/block/sheepdog.c b/block/sheepdog.c index 0a0803ee58..be3db1f150 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1829,14 +1829,12 @@ static int sd_create(const char *filename, QemuOpts *opts, if (s->inode.block_size_shift == 0) { SheepdogVdiReq hdr; SheepdogClusterRsp *rsp = (SheepdogClusterRsp *)&hdr; - Error *local_err = NULL; int fd; unsigned int wlen = 0, rlen = 0; - fd = connect_to_sdog(s, &local_err); + fd = connect_to_sdog(s, errp); if (fd < 0) { - error_report_err(local_err); - ret = -EIO; + ret = fd; goto out; }