From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8z17-0005Q0-TY for qemu-devel@nongnu.org; Mon, 03 May 2010 13:01:13 -0400 Received: from [140.186.70.92] (port=59982 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8z15-0005Ps-Om for qemu-devel@nongnu.org; Mon, 03 May 2010 13:01:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8z14-0007VG-1b for qemu-devel@nongnu.org; Mon, 03 May 2010 13:01:11 -0400 Received: from mail-iw0-f184.google.com ([209.85.223.184]:59194) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8z13-0007VB-TM for qemu-devel@nongnu.org; Mon, 03 May 2010 13:01:10 -0400 Received: by iwn14 with SMTP id 14so3497091iwn.22 for ; Mon, 03 May 2010 10:01:09 -0700 (PDT) Message-ID: <4BDF014E.10709@codemonkey.ws> Date: Mon, 03 May 2010 12:01:02 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/3] qemu-nbd: Improve error reporting 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> In-Reply-To: <4BB088E5.30800@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Ryota Ozaki , qemu-devel@nongnu.org On 03/29/2010 06:03 AM, Kevin Wolf wrote: > Am 28.03.2010 19:07, schrieb Ryota Ozaki: > >> - use err(3) instead of errx(3) if errno is available >> to report why failed >> - let fail prior to daemon(3) if opening a nbd file >> is likely to fail after daemonizing to avoid silent >> failure exit >> - add missing 'ret = 1' when unix_socket_outgoing failed >> >> Signed-off-by: Ryota Ozaki >> > Acked-by: Kevin Wolf > Are you going to pull this into the block branch? Regards, Anthony Liguori >> @@ -343,25 +343,31 @@ int main(int argc, char **argv) >> return 1; >> } >> >> - if (bdrv_open(bs, argv[optind], flags)< 0) { >> - return 1; >> + if ((ret = bdrv_open(bs, argv[optind], flags))< 0) { >> + errno = -ret; >> + err(EXIT_FAILURE, "Failed to bdrv_open '%s'", argv[optind]); >> } >> > 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. > > Kevin > > > >