From d8f14591d10df847fad2e24f2f430b2543020912 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 18 Jan 2013 07:11:13 +0000 Subject: [PATCH] daemon: lvm: Fix various paths relative to new lvm_system_dir. This fixes commit 9fd41abd40c3ffc10985e862dc34c868360a1b22. --- daemon/lvm-filter.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c index fddf816..0048f29 100644 --- a/daemon/lvm-filter.c +++ b/daemon/lvm-filter.c @@ -37,7 +37,13 @@ GUESTFSD_EXT_CMD(str_rm, rm); /* This runs during daemon start up and creates a complete copy of * /etc/lvm so that we can modify it as we desire. We set - * LVM_SYSTEM_DIR to point to the copy. + * LVM_SYSTEM_DIR to point to the copy. Note that the final directory + * layout is: + * /tmp/lvmXXXXXX (lvm_system_dir set to this) + * /tmp/lvmXXXXXX/lvm ($LVM_SYSTEM_DIR set to this) + * /tmp/lvmXXXXXX/lvm/lvm.conf (configuration file) + * /tmp/lvmXXXXXX/lvm/cache + * etc. */ static char lvm_system_dir[] = "/tmp/lvmXXXXXX"; @@ -130,10 +136,11 @@ static int set_filter (const char *filter) { char lvm_conf[64]; - snprintf (lvm_conf, sizeof lvm_conf, "%s/lvm.conf", lvm_system_dir); + snprintf (lvm_conf, sizeof lvm_conf, "%s/lvm/lvm.conf", lvm_system_dir); char lvm_conf_new[64]; - snprintf (lvm_conf_new, sizeof lvm_conf, "%s/lvm.conf.new", lvm_system_dir); + snprintf (lvm_conf_new, sizeof lvm_conf, "%s/lvm/lvm.conf.new", + lvm_system_dir); FILE *ifp = fopen (lvm_conf, "r"); if (ifp == NULL) { @@ -224,7 +231,7 @@ static int rescan (void) { char lvm_cache[64]; - snprintf (lvm_cache, sizeof lvm_cache, "%s/cache/.cache", lvm_system_dir); + snprintf (lvm_cache, sizeof lvm_cache, "%s/lvm/cache/.cache", lvm_system_dir); unlink (lvm_cache); -- 1.8.0.1