From: Christian Brauner Date: Fri, 23 Mar 2018 19:30:38 +0000 (+0100) Subject: lxccontainer: truncate config file X-Git-Tag: lxc-3.0.0.beta3~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10034af509cca0a4e5bccf9fa740888d2f2f2348;p=thirdparty%2Flxc.git lxccontainer: truncate config file Signed-off-by: Christian Brauner --- 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;