cgroups: remove unnecessary get_paths()

Change get_mounts to get paths from a borrowed argument rather than
calling get_paths a second time.

Fixes #3768

Signed-off-by: Derek Lee <derlee@redhat.com>
This commit is contained in:
Derek Lee 2022-07-12 10:03:24 -07:00
parent cda1919a0a
commit 9ae2a45b38

View File

@ -911,9 +911,8 @@ pub fn get_paths() -> Result<HashMap<String, String>> {
Ok(m)
}
pub fn get_mounts() -> Result<HashMap<String, String>> {
pub fn get_mounts(paths: &HashMap<String, String>) -> Result<HashMap<String, String>> {
let mut m = HashMap::new();
let paths = get_paths()?;
for l in fs::read_to_string(MOUNTS)?.lines() {
let p: Vec<&str> = l.splitn(2, " - ").collect();
@ -951,7 +950,7 @@ impl Manager {
let mut m = HashMap::new();
let paths = get_paths()?;
let mounts = get_mounts()?;
let mounts = get_mounts(&paths)?;
for key in paths.keys() {
let mnt = mounts.get(key);