From: Ryota Ozaki Date: Sat, 20 Mar 2010 07:08:38 +0000 (+0900) Subject: qemu-io: Fix return value handling of bdrv_open X-Git-Tag: v0.13.0-rc0~958 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06b611c48edb1bf0301c3e7fe49dec2b9feaaf89;p=thirdparty%2Fqemu.git 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 Signed-off-by: Aurelien Jarno --- diff --git a/qemu-io.c b/qemu-io.c index b2f2f5a9a97..2f195bfe4fe 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;