[PATCH v2.1 02/10] btrfs-progs: image: Fix error output to show correct return value

Qu Wenruo
2019-07-04T06:11:14Z

We can easily get confusing error message like:
ERROR: restore failed: Success

This is caused by wrong "%m" usage, as we normally use ret to indicate
error, without populating errno.

This patch will fix it by output the return value directly as normally
we have extra error message to show more meaning message than the return
value.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
image/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/image/main.c b/image/main.c
index fb407f33f858..7c499c0853d0 100644
--- a/image/main.c
+++ b/image/main.c
@@ -2734,7 +2734,7 @@ int BOX_MAIN(image)(int argc, char *argv[])
0, target, multi_devices);
}
if (ret) {
- error("%s failed: %m", (create) ? "create" : "restore");
+ error("%s failed: %d", (create) ? "create" : "restore", ret);
goto out;
}

--
2.22.0