diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 745584308..09095ff9f 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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; 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;