[pbs-devel] [PATCH proxmox-backup] clean up .bad file handling in sweep_unused_chunks

Dietmar Maurer dietmar at proxmox.com
Thu Sep 10 06:37:34 CEST 2020


> +                    // filename validity checked in iterator
> +                    let orig_filename = std::ffi::CString::new(&filename.to_bytes()[..64]).unwrap();

As discussed in private, CString::new can never fail here, so unwrap() is safe.

Nethertheless, I prefer:

-    let orig_filename = std::ffi::CString::new(&filename.to_bytes()[..64]).unwrap();
+    let orig_filename = std::ffi::CString::new(&filename.to_bytes()[..64])?;





More information about the pbs-devel mailing list