mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
rustjail: fix the issue of invalid cgroup_parent path
The cgroup_parent path is expected to be absolute path, add an '/' prefix to the passed cgroup_parent path to make sure it's an absolute path. Fixes: #336 Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
This commit is contained in:
parent
7f20587433
commit
c133a4561d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user