From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nssh3-0005P4-SB for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:01:57 -0400 Received: from [199.232.76.173] (port=52069 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nssh3-0005OO-3R for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:01:57 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nssh0-0002LS-7A for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:01:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65498) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nssgz-0002LG-Rv for qemu-devel@nongnu.org; Sat, 20 Mar 2010 03:01:54 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 1/3] qemu-nbd: Fix return value handling of bdrv_open References: <1269066204-4376-1-git-send-email-ozaki.ryota@gmail.com> Date: Sat, 20 Mar 2010 08:01:49 +0100 In-Reply-To: <1269066204-4376-1-git-send-email-ozaki.ryota@gmail.com> (Ryota Ozaki's message of "Sat, 20 Mar 2010 15:23:22 +0900") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ryota Ozaki Cc: qemu-devel@nongnu.org Ryota Ozaki writes: > 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; Same bug in qemu-io.c. Could you fix that as well?