---
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;
}
--
1.8.5.3