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:
@@ -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);
