ringbuf: 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 a324e7eb
...@@ -52,10 +52,12 @@ int lxc_ringbuf_create(struct lxc_ringbuf *buf, size_t size) ...@@ -52,10 +52,12 @@ int lxc_ringbuf_create(struct lxc_ringbuf *buf, size_t size)
memfd = memfd_create(".lxc_ringbuf", MFD_CLOEXEC); memfd = memfd_create(".lxc_ringbuf", MFD_CLOEXEC);
if (memfd < 0) { if (memfd < 0) {
char template[] = P_tmpdir "/.lxc_ringbuf_XXXXXX";
if (errno != ENOSYS) if (errno != ENOSYS)
goto on_error; goto on_error;
memfd = lxc_make_tmpfile((char *){P_tmpdir"/.lxc_ringbuf_XXXXXX"}, true); memfd = lxc_make_tmpfile(template, true);
} }
if (memfd < 0) if (memfd < 0)
goto on_error; goto on_error;
......
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