cmd_fsck: Collect return code of kernel fsck with close()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-02-17 20:57:07 -05:00
parent b2824ebac1
commit 6ff5313cbe
2 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
VERSION=1.4.0 VERSION=1.6.2
PREFIX?=/usr/local PREFIX?=/usr/local
LIBEXECDIR?=$(PREFIX)/libexec LIBEXECDIR?=$(PREFIX)/libexec

View File

@ -70,15 +70,17 @@ static int splice_fd_to_stdinout(int fd)
select(fd + 1, &fds, NULL, NULL, NULL); select(fd + 1, &fds, NULL, NULL, NULL);
int r = do_splice(fd, STDOUT_FILENO); int r = do_splice(fd, STDOUT_FILENO);
if (r < 0)
return r;
if (r) if (r)
return r < 0 ? r : 0; break;
r = do_splice(STDIN_FILENO, fd); r = do_splice(STDIN_FILENO, fd);
if (r < 0) if (r < 0)
return r; return r;
} }
return 0; return close(fd);
} }
static int fsck_online(const char *dev_path) static int fsck_online(const char *dev_path)