Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsspQ-0000Jc-SX for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:10:36 -0400 Received: from [199.232.76.173] (port=47180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsspQ-0000JT-HV for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:10:36 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NsspP-000306-TY for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:10:36 -0400 Received: from mail-yw0-f198.google.com ([209.85.211.198]:63300) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NsspP-0002zu-GO for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:10:35 -0400 Received: by ywh36 with SMTP id 36so939223ywh.4 for ; Sat, 20 Mar 2010 00:10:35 -0700 (PDT) From: Ryota Ozaki Date: Sat, 20 Mar 2010 16:08:38 +0900 Message-Id: <1269068918-6163-1-git-send-email-ozaki.ryota@gmail.com> Subject: [Qemu-devel] [PATCH] qemu-io: Fix return value handling of bdrv_open List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org bdrv_open may return -errno so we have to check if the return value is '< 0', not '== -1'. Signed-off-by: Ryota Ozaki --- qemu-io.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index b2f2f5a..2f195bf 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; -- 1.6.5.2