Skip to content

Commit

Permalink
Merge pull request lxc#2261 from brauner/2018-04-06/thmo_patch_1
Browse files Browse the repository at this point in the history
Fix temp file creation
  • Loading branch information
Christian Brauner authored Apr 6, 2018
2 parents 83ffaa1 + 709384a commit 5eda487
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
4 changes: 3 additions & 1 deletion src/lxc/ringbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ int lxc_ringbuf_create(struct lxc_ringbuf *buf, size_t size)

memfd = memfd_create(".lxc_ringbuf", MFD_CLOEXEC);
if (memfd < 0) {
char template[] = P_tmpdir "/.lxc_ringbuf_XXXXXX";

if (errno != ENOSYS)
goto on_error;

memfd = lxc_make_tmpfile((char *){P_tmpdir"/.lxc_ringbuf_XXXXXX"}, true);
memfd = lxc_make_tmpfile(template, true);
}
if (memfd < 0)
goto on_error;
Expand Down

0 comments on commit 5eda487

Please sign in to comment.