[lxc-devel] [PATCH] clone: only update <rootfs>/etc/hostname if it exists

Dwight Engen dwight.engen at oracle.com
Tue Jul 16 14:35:02 UTC 2013


Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/lxccontainer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index c5aae99..b0695bc 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1987,6 +1987,8 @@ static int clone_update_rootfs(struct lxc_container *c0,
 		ret = snprintf(path, MAXPATHLEN, "%s/etc/hostname", bdev->dest);
 		if (ret < 0 || ret >= MAXPATHLEN)
 			exit(1);
+		if (!file_exists(path))
+			exit(0);
 		if (!(fout = fopen(path, "w"))) {
 			SYSERROR("unable to open %s: ignoring\n", path);
 			exit(0);
-- 
1.8.1.4





More information about the lxc-devel mailing list