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

index 7455843086c543d6219dcbcfcb9093bd73e61da2..09095ff9f1906f86b3592eb2136f45a58e932460 100644 (file)
@@ -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;