Merge pull request #694 from lifupan/2.0-dev

rustjail: fix the issue of invalid cgroup_parent path
This commit is contained in:
Peng Tao 2020-09-11 10:28:33 +08:00 committed by GitHub
commit e3ea8544f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1389,10 +1389,6 @@ impl Manager {
pub fn new(cpath: &str) -> Result<Self> {
let mut m = HashMap::new();
if !cpath.starts_with('/') {
return Err(nix::Error::Sys(Errno::EINVAL).into());
}
let paths = get_paths()?;
let mounts = get_mounts()?;
@ -1404,9 +1400,9 @@ impl Manager {
}
let p = if value == "/" {
format!("{}{}", mnt.unwrap(), cpath)
format!("{}/{}", mnt.unwrap(), cpath)
} else {
format!("{}{}{}", mnt.unwrap(), value, cpath)
format!("{}{}/{}", mnt.unwrap(), value, cpath)
};
m.insert(key.to_string(), p);