From: Christian Brauner Date: Fri, 6 Apr 2018 08:54:41 +0000 (+0200) Subject: ringbuf: fix temporary file creation X-Git-Tag: lxc-3.1.0~337^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2261%2Fhead;p=thirdparty%2Flxc.git 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: Thomas Moschny Signed-off-by: Christian Brauner --- diff --git a/src/lxc/ringbuf.c b/src/lxc/ringbuf.c index 1299fe709..7aa2e6310 100644 --- a/src/lxc/ringbuf.c +++ b/src/lxc/ringbuf.c @@ -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;