diff options
author | Thomas Bertschinger <tahbertschinger@gmail.com> | 2024-05-24 22:00:27 -0600 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-25 00:02:27 -0400 |
commit | 7bf821f3f988d3ba9c88d4baf303aef18bb097f3 (patch) | |
tree | 2d101b4baf2b15ac4c7d770ccc715ee8b5fb6690 /c_src/cmd_fsck.c | |
parent | ff44b8b96d5a44444aa8eaa5282dbc92c069135f (diff) |
check errno to determine fsck ioctl error
The error code is in errno, not the return value.
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/cmd_fsck.c')
-rw-r--r-- | c_src/cmd_fsck.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/c_src/cmd_fsck.c b/c_src/cmd_fsck.c index f1f4ae89..68d22fd4 100644 --- a/c_src/cmd_fsck.c +++ b/c_src/cmd_fsck.c @@ -1,4 +1,5 @@ +#include <errno.h> #include <getopt.h> #include <sys/uio.h> #include <unistd.h> @@ -98,7 +99,7 @@ static int fsck_online(const char *dev_path) int fsck_fd = ioctl(fs.ioctl_fd, BCH_IOCTL_FSCK_ONLINE, &fsck); if (fsck_fd < 0) - die("BCH_IOCTL_FSCK_ONLINE error: %s", bch2_err_str(fsck_fd)); + die("BCH_IOCTL_FSCK_ONLINE error: %s", bch2_err_str(errno)); return splice_fd_to_stdinout(fsck_fd); } @@ -249,7 +250,7 @@ int cmd_fsck(int argc, char *argv[]) goto userland_fsck; if (fsck_fd < 0) - die("BCH_IOCTL_FSCK_OFFLINE error: %s", bch2_err_str(fsck_fd)); + die("BCH_IOCTL_FSCK_OFFLINE error: %s", bch2_err_str(errno)); ret = splice_fd_to_stdinout(fsck_fd); } else { |