From: Max Reitz Date: Tue, 2 Dec 2014 17:32:53 +0000 (+0100) Subject: block/raw-posix: Fix ret in raw_open_common() X-Git-Tag: qemu-xen-4.6.0-rc1~34^2~42 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6950b92765595fe3255f6127a517c3866c5df4bd;p=qemu-upstream-4.6-testing.git block/raw-posix: Fix ret in raw_open_common() The return value must be negative on error; there is one place in raw_open_common() where errp is set, but ret remains 0. Fix it. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf (cherry picked from commit 01212d4ed68fc8daa29062a9a38650cf8febe392) Signed-off-by: Michael Roth --- diff --git a/block/raw-posix.c b/block/raw-posix.c index d8bbed067..ef2124289 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -446,6 +446,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } if (fstat(s->fd, &st) < 0) { + ret = -errno; error_setg_errno(errp, errno, "Could not stat file"); goto fail; }