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: 's avatarThomas Moschny <thomas.moschny@gmx.de> Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 83ffaa1d
...@@ -2286,9 +2286,12 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment