]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
clone: only update <rootfs>/etc/hostname if it exists
authorDwight Engen <dwight.engen@oracle.com>
Tue, 16 Jul 2013 14:35:02 +0000 (10:35 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 16 Jul 2013 22:25:25 +0000 (17:25 -0500)
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index c5aae99dc2b10bb67a1c6f4484d104e192e194dc..b0695bca2805284e7adf5c2cef5c976aab9a0e68 100644 (file)
@@ -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);