conf: fix temporary file creation

lxc_make_tmpfile() uses mkstemp() internally, and thus expects the
template to contain 'XXXXXX' and be writable.

Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-04-06 10:54:02 +02:00
parent 83ffaa1d39
commit a324e7eba0
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -2286,9 +2286,12 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)
fd = memfd_create(".lxc_mount_file", MFD_CLOEXEC); fd = memfd_create(".lxc_mount_file", MFD_CLOEXEC);
if (fd < 0) { if (fd < 0) {
char template[] = P_tmpdir "/.lxc_mount_file_XXXXXX";
if (errno != ENOSYS) if (errno != ENOSYS)
return NULL; return NULL;
fd = lxc_make_tmpfile((char *){P_tmpdir "/.lxc_mount_file"}, true);
fd = lxc_make_tmpfile(template, true);
if (fd < 0) { if (fd < 0) {
SYSERROR("Could not create temporary mount file"); SYSERROR("Could not create temporary mount file");
return NULL; return NULL;