From 7bc7601f65ff62588fbdbb55abf4ded4def98c8e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 15 May 2024 11:55:12 +0200 Subject: [PATCH] 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 --- .../src/proxmox_restore_daemon/api.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs index c2055222..cb7b53e1 100644 --- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs +++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs @@ -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() + ); + } } } } -- 2.39.5