]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: truncate config file 2233/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 23 Mar 2018 19:30:38 +0000 (20:30 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 23 Mar 2018 19:30:38 +0000 (20:30 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 076c68472b48c12067a1863bcbb547d36acd638c..6d41b6cf15e948c56f4dd67cf0d52f882ee346f3 100644 (file)
@@ -2500,11 +2500,10 @@ static bool do_lxcapi_save_config(struct lxc_container *c, const char *alt_file)
                lret = container_disk_lock(c);
        else
                lret = container_mem_lock(c);
-
        if (lret)
                return false;
 
-       fd = open(alt_file, O_WRONLY | O_CREAT | O_CLOEXEC,
+       fd = open(alt_file, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
                  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        if (fd < 0)
                goto on_error;