esrlabs / northstar

Embedded container runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible inconsistency when the removal of a data dir fails

flxo opened this issue · comments

Possible inconsistency when removing of a data dir fails and the code returns early because of the ? and the container is left in the containers map.

if wipe {
let name: &str = container.name().as_ref();
let dir = self.config.data_dir.join(name);
if dir.exists() {
info!(
"Wiping persistent data dir {} of {}",
dir.display(),
container
);
fs::remove_dir_all(&dir)
.await
.with_context(|| format!("failed to remove {}", dir.display()))?;
}
}
self.containers.remove(container);