From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8h5j-0005aF-1P for qemu-devel@nongnu.org; Sun, 02 May 2010 17:52:47 -0400 Received: from [140.186.70.92] (port=55894 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8h5g-0005VR-Ip for qemu-devel@nongnu.org; Sun, 02 May 2010 17:52:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8h5U-0004Ye-Ht for qemu-devel@nongnu.org; Sun, 02 May 2010 17:52:33 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:37238) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8h5U-0004YW-Bq for qemu-devel@nongnu.org; Sun, 02 May 2010 17:52:32 -0400 Received: by wyj26 with SMTP id 26so1181512wyj.4 for ; Sun, 02 May 2010 14:52:31 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4BB088E5.30800@redhat.com> References: <1269796032-9166-1-git-send-email-ozaki.ryota@gmail.com> <1269796032-9166-3-git-send-email-ozaki.ryota@gmail.com> <4BB088E5.30800@redhat.com> From: Ryota Ozaki Date: Mon, 3 May 2010 06:52:11 +0900 Message-ID: Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-nbd: Improve error reporting Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Mon, Mar 29, 2010 at 8:03 PM, Kevin Wolf wrote: > Am 28.03.2010 19:07, schrieb Ryota Ozaki: >> - use err(3) instead of errx(3) if errno is available >> =A0 to report why failed >> - let fail prior to daemon(3) if opening a nbd file >> =A0 is likely to fail after daemonizing to avoid silent >> =A0 failure exit >> - add missing 'ret =3D 1' when unix_socket_outgoing failed >> >> Signed-off-by: Ryota Ozaki > > Acked-by: Kevin Wolf > >> @@ -343,25 +343,31 @@ int main(int argc, char **argv) >> =A0 =A0 =A0 =A0 =A0return 1; >> =A0 =A0 =A0} >> >> - =A0 =A0if (bdrv_open(bs, argv[optind], flags) < 0) { >> - =A0 =A0 =A0 =A0return 1; >> + =A0 =A0if ((ret =3D bdrv_open(bs, argv[optind], flags)) < 0) { >> + =A0 =A0 =A0 =A0errno =3D -ret; >> + =A0 =A0 =A0 =A0err(EXIT_FAILURE, "Failed to bdrv_open '%s'", argv[opti= nd]); >> =A0 =A0 =A0} > > If you do it like this, you could do the change for even more errors, > like the ones returned by bdrv_read. But that doesn't make this patch > less correct, of course. Indeed. So I will include the changes for bdrv_read as well in the next round. Thanks, ozaki-r > > Kevin >