Skip to content

Commit

Permalink
conf: fix temporary file creation
Browse files Browse the repository at this point in the history
lxc_make_tmpfile() uses mkstemp() internally, and thus expects the
template to contain 'XXXXXX' and be writable.

Signed-off-by: Thomas Moschny <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
Christian Brauner committed Apr 6, 2018
1 parent 83ffaa1 commit a324e7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lxc/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2286,9 +2286,12 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)

fd = memfd_create(".lxc_mount_file", MFD_CLOEXEC);
if (fd < 0) {
char template[] = P_tmpdir "/.lxc_mount_file_XXXXXX";

if (errno != ENOSYS)
return NULL;
fd = lxc_make_tmpfile((char *){P_tmpdir "/.lxc_mount_file"}, true);

fd = lxc_make_tmpfile(template, true);
if (fd < 0) {
SYSERROR("Could not create temporary mount file");
return NULL;
Expand Down

0 comments on commit a324e7e

Please sign in to comment.