[sheepdog] [PATCH] sheepdog: Fix misleading error messages in sd_snapshot_create()

Markus Armbruster armbru at redhat.com
Thu Feb 12 14:49:50 CET 2015

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

Reported-by: Eric Blake <eblake at redhat.com>
Signed-off-by: Markus Armbruster <armbru at redhat.com>
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;

More information about the sheepdog mailing list