From c4ad2c0ce3eea1fdb6e1123e8d5fcfed2d5a0849 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 16 Dec 2012 18:35:31 +0000 Subject: [PATCH] daemon: Fold stdout on stderr when running e2fsck. User Phill Bandelow noted that virt-resize fails with an e2fsck error on a host where the system clock had been accidentally set in the past. Unfortunately this was hard to diagnose because guestfsd 'ate' the stdout of the e2fsck program. I have verified by code inspection that e2fsck prints messages on stdout. Thus this changes the daemon to fold stdout and stderr together so we get to see all error messages from e2fsck when it fails. --- daemon/ext2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/ext2.c b/daemon/ext2.c index 0d1a7869e..ab879dbed 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -171,7 +171,9 @@ if_not_mounted_run_e2fsck (const char *device) return -1; if (!mounted) { - r = command (NULL, &err, str_e2fsck, "-fy", device, NULL); + r = commandf (NULL, &err, + COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_e2fsck, "-fy", device, NULL); if (r == -1) { reply_with_error ("%s", err); free (err); @@ -291,7 +293,9 @@ do_e2fsck (const char *device, ADD_ARG (argv, i, device); ADD_ARG (argv, i, NULL); - r = commandv (NULL, &err, argv); + r = commandvf (NULL, &err, + COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + argv); /* 0 = no errors, 1 = errors corrected. * * >= 4 means uncorrected or other errors.