From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM7NZ-0008VP-8L for qemu-devel@nongnu.org; Thu, 12 Feb 2015 22:57:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM7NW-0007Er-21 for qemu-devel@nongnu.org; Thu, 12 Feb 2015 22:57:21 -0500 Received: from mail-ig0-x232.google.com ([2607:f8b0:4001:c05::232]:38763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM7NV-0007EU-Tl for qemu-devel@nongnu.org; Thu, 12 Feb 2015 22:57:17 -0500 Received: by mail-ig0-f178.google.com with SMTP id hl2so8309534igb.5 for ; Thu, 12 Feb 2015 19:57:17 -0800 (PST) Date: Fri, 13 Feb 2015 11:57:16 +0800 From: Liu Yuan Message-ID: <20150213035716.GB21936@ubuntu-trusty> References: <1423748990-9709-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423748990-9709-1-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [PATCH] sheepdog: Fix misleading error messages in sd_snapshot_create() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: mitake.hitoshi@lab.ntt.co.jp, kwolf@redhat.com, sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, Feb 12, 2015 at 02:49:50PM +0100, Markus Armbruster wrote: > If do_sd_create() fails, it first reports the error returned, then > reports a another one with strerror(errno). errno is meaningless at > that point. > > Report just one error combining the valid information from both > messages. > > Reported-by: Eric Blake > Signed-off-by: Markus Armbruster > --- > Applies on top of my "[PATCH v2 00/10] Clean up around > error_get_pretty(), qerror_report_err()", but rebasing to master would > be trivial. > > block/sheepdog.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/block/sheepdog.c b/block/sheepdog.c > index 6a4a3bd..0e8c712 100644 > --- a/block/sheepdog.c > +++ b/block/sheepdog.c > @@ -2225,9 +2225,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) > > ret = do_sd_create(s, &new_vid, 1, &local_err); > if (ret < 0) { > - error_report_err(local_err); > - error_report("failed to create inode for snapshot. %s", > - strerror(errno)); > + error_report("failed to create inode for snapshot: %s", > + error_get_pretty(local_err)); > goto cleanup; > } Reviewed-by: Liu Yuan