e2fsck returns 1 in case of "file system errors corrected".
We treat it as success in normal e2fsck, but fail if e2fsck
is run by resize2fs.
Change 'manual' execution of e2fsck to dedicated function call.
---
daemon/ext2.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/daemon/ext2.c b/daemon/ext2.c
index 5dd67c7..95a65ae 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -192,24 +192,18 @@ do_get_e2uuid (const char *device)
static int
if_not_mounted_run_e2fsck (const char *device)
{
- CLEANUP_FREE char *err = NULL;
- int r, mounted;
+ int r = 0, mounted;
mounted = is_device_mounted (device);
if (mounted == -1)
return -1;
if (!mounted) {
- r = commandf (NULL, &err,
- COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_e2fsck, "-fy", device, NULL);
- if (r == -1) {
- reply_with_error ("%s", err);
- return -1;
- }
+ optargs_bitmask = GUESTFS_E2FSCK_FORCEALL_BITMASK;
+ r = do_e2fsck (device, 0, 1);
}
- return 0;
+ return r;
}
int
--
1.8.3.1