]> git.proxmox.com Git - lxc.git/blob - debian/patches/fixes/0009-conf-fix-temporary-file-creation.patch
301d1f1f068da7dd1d3762d544229b15ac048f6d
[lxc.git] / debian / patches / fixes / 0009-conf-fix-temporary-file-creation.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Christian Brauner <christian.brauner@ubuntu.com>
3 Date: Fri, 6 Apr 2018 10:54:02 +0200
4 Subject: [PATCH] conf: fix temporary file creation
5
6 lxc_make_tmpfile() uses mkstemp() internally, and thus expects the
7 template to contain 'XXXXXX' and be writable.
8
9 Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
10 Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
11 ---
12 src/lxc/conf.c | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15 diff --git a/src/lxc/conf.c b/src/lxc/conf.c
16 index a604adbb..c1193675 100644
17 --- a/src/lxc/conf.c
18 +++ b/src/lxc/conf.c
19 @@ -2277,9 +2277,12 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)
20
21 fd = memfd_create(".lxc_mount_file", MFD_CLOEXEC);
22 if (fd < 0) {
23 + char template[] = P_tmpdir "/.lxc_mount_file_XXXXXX";
24 +
25 if (errno != ENOSYS)
26 return NULL;
27 - fd = lxc_make_tmpfile((char *){P_tmpdir "/.lxc_mount_file"}, true);
28 +
29 + fd = lxc_make_tmpfile(template, true);
30 if (fd < 0) {
31 SYSERROR("Could not create temporary mount file");
32 return NULL;
33 --
34 2.11.0
35