[v3,02/10] btrfs-progs: image: Fix error output to show correct return value
diff mbox series

Message ID 20190925121356.118038-3-wqu@suse.com
State New
Headers show
  • btrfs-progs: image: Enhancement with new data dump feature
Related show

Commit Message

Qu Wenruo Sept. 25, 2019, 12:13 p.m. UTC
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

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

diff mbox series

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;