summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyota Ozaki <ozaki.ryota@gmail.com>2010-03-20 16:08:38 +0900
committerAurelien Jarno <aurelien@aurel32.net>2010-03-27 14:02:53 +0100
commit06b611c48edb1bf0301c3e7fe49dec2b9feaaf89 (patch)
tree5abf7744f40317c16d950d11a2ea6770729537ad
parentb6353bea572f8cc0f35fb7dc438ce74c08dda9e7 (diff)
downloadqemu-06b611c48edb1bf0301c3e7fe49dec2b9feaaf89.zip
qemu-io: Fix return value handling of bdrv_open
bdrv_open may return -errno so we have to check if the return value is '< 0', not '== -1'. Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r--qemu-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-io.c b/qemu-io.c
index b2f2f5a9a9..2f195bfe4f 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1284,7 +1284,7 @@ static int openfile(char *name, int flags, int growable)
flags |= BDRV_O_FILE;
}
- if (bdrv_open(bs, name, flags) == -1) {
+ if (bdrv_open(bs, name, flags) < 0) {
fprintf(stderr, "%s: can't open device %s\n", progname, name);
bs = NULL;
return 1;