If we're saving the config file to somewhere that's *not* the container
dir, we don't need to create the container dir. Let's not do this and
thus not require its parent to exist, which can be confusing, especially in
light of the sparse logging through these functions.
Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
int fd, lret;
bool ret = false, need_disklock = false;
- if (!alt_file)
- alt_file = c->configfile;
-
- if (!alt_file)
- return false;
-
/* If we haven't yet loaded a config, load the stock config. */
if (!c->lxc_conf) {
if (!do_lxcapi_load_config(c, lxc_global_config_value("lxc.default_config"))) {
}
}
- if (!create_container_dir(c))
+ if (!alt_file) {
+ alt_file = c->configfile;
+ if (!create_container_dir(c))
+ return false;
+ }
+
+ if (!alt_file)
return false;
/* If we're writing to the container's config file, take the disk lock.