From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwCkv-00042d-88 for qemu-devel@nongnu.org; Mon, 29 Mar 2010 07:03:41 -0400 Received: from [140.186.70.92] (port=59756 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwCku-000414-4R for qemu-devel@nongnu.org; Mon, 29 Mar 2010 07:03:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwCks-0005mX-Gj for qemu-devel@nongnu.org; Mon, 29 Mar 2010 07:03:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59859) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwCks-0005mE-9V for qemu-devel@nongnu.org; Mon, 29 Mar 2010 07:03:38 -0400 Message-ID: <4BB088E5.30800@redhat.com> Date: Mon, 29 Mar 2010 13:03:01 +0200 From: Kevin Wolf 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> In-Reply-To: <1269796032-9166-3-git-send-email-ozaki.ryota@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ryota Ozaki Cc: qemu-devel@nongnu.org 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 > @@ -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