]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ringbuf: fix temporary file creation 2261/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 6 Apr 2018 08:54:41 +0000 (10:54 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 6 Apr 2018 08:54:41 +0000 (10:54 +0200)
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>
src/lxc/ringbuf.c

index 1299fe709070d656c0a411ae8ef1ec0fff201c4d..7aa2e6310e3ae4965ca0d98100af6c4d5cc1ad5f 100644 (file)
@@ -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;