daemon: lvm: Fix various paths relative to new lvm_system_dir.

This fixes commit 9fd41abd40.
This commit is contained in:
Richard W.M. Jones
2013-01-18 07:11:13 +00:00
parent 312d02afe4
commit d8f14591d1

View File

@@ -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);