From 5e105e06be4cc6c88b5d3fc5cf79acb48947e197 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 12 Mar 2014 13:41:39 +0000 Subject: [PATCH] daemon: fstrim: Fix fstrim so it trims the correct filesystem. We didn't call sysroot_path, so it was trimming the appliance instead of the guest filesystem. --- daemon/fstrim.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/daemon/fstrim.c b/daemon/fstrim.c index bf9dad806..2aad155c8 100644 --- a/daemon/fstrim.c +++ b/daemon/fstrim.c @@ -46,6 +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 *buf = NULL; CLEANUP_FREE char *out = NULL, *err = NULL; int r; @@ -88,7 +89,13 @@ do_fstrim (const char *path, if (verbose) ADD_ARG (argv, i, "-v"); - ADD_ARG (argv, i, path); + buf = sysroot_path (path); + if (!buf) { + reply_with_error ("malloc"); + return -1; + } + + ADD_ARG (argv, i, buf); ADD_ARG (argv, i, NULL); r = commandv (&out, &err, argv);