[lxc-devel] [lxc/master] lxccontainer: truncate config file
brauner on Github
lxc-bot at linuxcontainers.org
Fri Mar 23 19:31:21 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180323/d87df721/attachment.bin>
-------------- next part --------------
From 10034af509cca0a4e5bccf9fa740888d2f2f2348 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 23 Mar 2018 20:30:38 +0100
Subject: [PATCH] lxccontainer: truncate config file
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
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;
More information about the lxc-devel
mailing list