Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nss7j-0003zA-7t for qemu-devel@nongnu.org; Sat, 20 Mar 2010 02:25:27 -0400 Received: from [199.232.76.173] (port=49775 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nss7i-0003z2-Nf for qemu-devel@nongnu.org; Sat, 20 Mar 2010 02:25:26 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nss7i-00070N-1q for qemu-devel@nongnu.org; Sat, 20 Mar 2010 02:25:26 -0400 Received: from mx20.gnu.org ([199.232.41.8]:45478) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nss7g-0006zi-Pb for qemu-devel@nongnu.org; Sat, 20 Mar 2010 02:25:25 -0400 Received: from mail-yx0-f191.google.com ([209.85.210.191]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nss7f-0003bb-Ty for qemu-devel@nongnu.org; Sat, 20 Mar 2010 02:25:24 -0400 Received: by yxe29 with SMTP id 29so1350815yxe.4 for ; Fri, 19 Mar 2010 23:25:23 -0700 (PDT) From: Ryota Ozaki Date: Sat, 20 Mar 2010 15:23:22 +0900 Message-Id: <1269066204-4376-1-git-send-email-ozaki.ryota@gmail.com> Subject: [Qemu-devel] [PATCH 1/3] qemu-nbd: 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-nbd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index a393583..b89c361 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -333,7 +333,7 @@ int main(int argc, char **argv) if (bs == NULL) return 1; - if (bdrv_open(bs, argv[optind], flags) == -1) + if (bdrv_open(bs, argv[optind], flags) < 0) return 1; fd_size = bs->total_sectors * 512; -- 1.6.5.2