]> xenbits.xensource.com Git - people/liuw/qemu.git/commitdiff
block/raw-posix: Fix ret in raw_open_common()
authorMax Reitz <mreitz@redhat.com>
Tue, 2 Dec 2014 17:32:53 +0000 (18:32 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sun, 22 Feb 2015 18:10:01 +0000 (12:10 -0600)
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 <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 01212d4ed68fc8daa29062a9a38650cf8febe392)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/raw-posix.c

index d8bbed06766265b94596af8cbff40000470b351e..ef21242891b27080a820717533eefe943009dbc9 100644 (file)
@@ -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;
     }