On Wed, Jun 22, 2016 at 04:43:13PM +0300, Maxim Perevedentsev wrote:
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;
Looks OK to me, ACK.
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW