[PATCH v2 14/14] btrfs-progs: image: Fix error output to show correct return value

WenRuo Qu
2019-07-02T10:26:21Z

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 0be3b45569ed..2bf3cfe395ec 100644
--- a/image/main.c
+++ b/image/main.c
@@ -3150,7 +3150,7 @@ int main(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