diff mbox

[78/88] block/raw-posix: Fix ret in raw_open_common()

Message ID 1420738472-23267-79-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Jan. 8, 2015, 5:34 p.m. UTC
From: Max Reitz <mreitz@redhat.com>

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 | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 2d51f26..efa5686 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -447,6 +447,7 @@  static int raw_open_common(BlockDriverState *bs, QDict *options,
     s->has_write_zeroes = true;
 
     if (fstat(s->fd, &st) < 0) {
+        ret = -errno;
         error_setg_errno(errp, errno, "Could not stat file");
         goto fail;
     }