[Pkg-libvirt-commits] [libguestfs] 10/59: daemon: fstrim: When debugging, capture and print fstrim -v output.

Hilko Bengen bengen at moszumanska.debian.org
Thu Mar 20 23:05:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 46e30c1f7c90f8f24d1261a9bc37e05f9ef2a552
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Mar 11 21:54:13 2014 +0000

    daemon: fstrim: When debugging, capture and print fstrim -v output.
---
 daemon/fstrim.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/daemon/fstrim.c b/daemon/fstrim.c
index cb844d1..bf9dad8 100644
--- a/daemon/fstrim.c
+++ b/daemon/fstrim.c
@@ -46,7 +46,7 @@ do_fstrim (const char *path,
   const char *argv[MAX_ARGS];
   size_t i = 0;
   char offset_s[64], length_s[64], mfe_s[64];
-  CLEANUP_FREE char *err = NULL;
+  CLEANUP_FREE char *out = NULL, *err = NULL;
   int r;
 
   ADD_ARG (argv, i, str_fstrim);
@@ -84,14 +84,21 @@ do_fstrim (const char *path,
     ADD_ARG (argv, i, mfe_s);
   }
 
+  /* When running in debug mode, use -v, capture stdout and print it below. */
+  if (verbose)
+    ADD_ARG (argv, i, "-v");
+
   ADD_ARG (argv, i, path);
   ADD_ARG (argv, i, NULL);
 
-  r = commandv (NULL, &err, argv);
+  r = commandv (&out, &err, argv);
   if (r == -1) {
     reply_with_error ("%s", err);
     return -1;
   }
 
+  if (verbose)
+    fprintf (stderr, "%s\n", out);
+
   return 0;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list