mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
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>
This commit is contained in:
parent
ff44b8b96d
commit
7bf821f3f9
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <unistd.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);
|
int fsck_fd = ioctl(fs.ioctl_fd, BCH_IOCTL_FSCK_ONLINE, &fsck);
|
||||||
if (fsck_fd < 0)
|
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);
|
return splice_fd_to_stdinout(fsck_fd);
|
||||||
}
|
}
|
||||||
@ -249,7 +250,7 @@ int cmd_fsck(int argc, char *argv[])
|
|||||||
goto userland_fsck;
|
goto userland_fsck;
|
||||||
|
|
||||||
if (fsck_fd < 0)
|
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);
|
ret = splice_fd_to_stdinout(fsck_fd);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user