diff --git a/src/lxc/conf.c b/src/lxc/conf.c index c1236b4f1..6bc9ecb4a 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1808,7 +1808,7 @@ static int mount_entry_create_dir_file(const struct mntent *mntent, const char* path) { char *pathdirname = NULL; - int ret; + int ret = 0; FILE *pathfile = NULL; if (hasmntopt(mntent, "create=dir")) { @@ -1846,6 +1846,12 @@ static inline int mount_entry_on_generic(struct mntent *mntent, ret = mount_entry_create_dir_file(mntent, path); + if (ret < 0) + return optional ? 0 : -1; + + if (ret < 0 && !optional) + return -1; + cull_mntent_opt(mntent); if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) {