forked from pool/libguestfs
Olaf Hering
453ca336fc
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=187
54 lines
1.5 KiB
Diff
54 lines
1.5 KiB
Diff
From 9fd41abd40c3ffc10985e862dc34c868360a1b22 Mon Sep 17 00:00:00 2001
|
|
From: Olaf Hering <olaf@aepfle.de>
|
|
Date: Wed, 2 Jan 2013 16:13:06 +0100
|
|
Subject: [PATCH] daemon: copy entire lvm directory
|
|
|
|
cp will fail if /etc/lvm is an empty directory. Copy the entire
|
|
directory and adjust environment variable.
|
|
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
|
|
|
RWMJ:
|
|
- Fixed a couple of whitespace issues.
|
|
---
|
|
daemon/lvm-filter.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
|
|
index 52d6b3d..fddf816 100644
|
|
--- a/daemon/lvm-filter.c
|
|
+++ b/daemon/lvm-filter.c
|
|
@@ -47,7 +47,7 @@ void
|
|
copy_lvm (void)
|
|
{
|
|
struct stat statbuf;
|
|
- char cmd[64];
|
|
+ char cmd[64], env[64];
|
|
int r;
|
|
|
|
/* If /etc/lvm directory doesn't exist (or isn't a directory) assume
|
|
@@ -68,8 +68,8 @@ copy_lvm (void)
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
|
|
- /* Hopefully no dotfiles in there ... XXX */
|
|
- snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/* %s", str_cp, lvm_system_dir);
|
|
+ /* Copy the entire directory */
|
|
+ snprintf (cmd, sizeof cmd, "%s -a /etc/lvm/ %s", str_cp, lvm_system_dir);
|
|
r = system (cmd);
|
|
if (r == -1) {
|
|
perror (cmd);
|
|
@@ -85,7 +85,8 @@ copy_lvm (void)
|
|
}
|
|
|
|
/* Set environment variable so we use the copy. */
|
|
- setenv ("LVM_SYSTEM_DIR", lvm_system_dir, 1);
|
|
+ snprintf (env, sizeof env, "%s/lvm", lvm_system_dir);
|
|
+ setenv ("LVM_SYSTEM_DIR", env, 1);
|
|
|
|
/* Set a handler to remove the temporary directory at exit. */
|
|
atexit (rm_lvm_system_dir);
|
|
--
|
|
1.8.0.1
|
|
|