[pbs-devel] [PATCH proxmox-backup 2/3] restore daemon: log some errors for dir traversal

Dominik Csapak d.csapak at proxmox.com
Wed May 15 11:55:12 CEST 2024


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 at proxmox.com>
---
 .../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 c20552225..cb7b53e11 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.2





More information about the pbs-devel mailing list