From 1eae1d718c228fb1fc3e7a47a830a2c71f84b5cf Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 19 Dec 2022 16:05:54 -0500 Subject: Use bch2_err_str() instead of strerror() This correctly prints out our private error codes. Signed-off-by: Kent Overstreet --- cmd_format.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd_format.c') diff --git a/cmd_format.c b/cmd_format.c index 4debc285..9feb3345 100644 --- a/cmd_format.c +++ b/cmd_format.c @@ -24,6 +24,7 @@ #include "libbcachefs.h" #include "crypto.h" #include "libbcachefs/darray.h" +#include "libbcachefs/errcode.h" #include "libbcachefs/opts.h" #include "libbcachefs/super-io.h" #include "libbcachefs/util.h" @@ -270,7 +271,7 @@ int cmd_format(int argc, char *argv[]) mount_opts); if (IS_ERR(c)) die("error opening %s: %s", device_paths.data[0], - strerror(-PTR_ERR(c))); + bch2_err_str(PTR_ERR(c))); bch2_fs_stop(c); } @@ -336,7 +337,7 @@ int cmd_show_super(int argc, char *argv[]) struct bch_sb_handle sb; int ret = bch2_read_super(dev, &opts, &sb); if (ret) - die("Error opening %s: %s", dev, strerror(-ret)); + die("Error opening %s: %s", dev, bch2_err_str(ret)); struct printbuf buf = PRINTBUF; -- cgit v1.2.3