2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 12:09:35 +00:00

confile: allow including nonexisting directories

If an include directive ends with a trailing slash, we now
always assume it is a directory and do not treat the
non-existence as an error.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-07-05 10:53:41 +02:00
committed by Christian Brauner
parent 76bdf15acd
commit 37f188d9ac

View File

@@ -2545,7 +2545,7 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
dir = opendir(dirp);
if (!dir)
return -errno;
return errno == ENOENT ? 0 : -errno;
while ((direntp = readdir(dir))) {
const char *fnam;
@@ -2582,7 +2582,7 @@ static int set_config_includefiles(const char *key, const char *value,
return 0;
}
if (is_dir(value))
if (value[strlen(value)-1] == '/' || is_dir(value))
return do_includedir(value, lxc_conf);
return lxc_config_read(value, lxc_conf, true);