restore daemon: log some errors for dir traversal

in case we cannot stat a file in the restore vm, log the path and reason
why. This should normally not happen, but when it does, the path and
error might help us find the issue.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2024-05-15 11:55:12 +02:00 committed by Fabian Grünbichler
parent 31edde560a
commit 7bc7601f65

View File

@ -182,12 +182,17 @@ fn list(
let mut full_path = PathBuf::new();
full_path.push(param_path_buf);
full_path.push(path);
let entry = get_dir_entry(&full_vm_path);
if let Ok(entry) = entry {
res.push(ArchiveEntry::new(
match get_dir_entry(&full_vm_path) {
Ok(entry) => res.push(ArchiveEntry::new(
full_path.as_os_str().as_bytes(),
Some(&entry),
));
)),
Err(err) => {
eprintln!(
"error getting entry: {:?} : {err}",
full_path.as_os_str()
);
}
}
}
}