From 10034af509cca0a4e5bccf9fa740888d2f2f2348 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 23 Mar 2018 20:30:38 +0100 Subject: [PATCH] lxccontainer: truncate config file Signed-off-by: Christian Brauner --- src/lxc/lxccontainer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 076c68472..6d41b6cf1 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -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; -- 2.47.2