chroot: remove unwrap calls (#7890)

This commit is contained in:
jovie :)
2025-05-28 09:29:19 +02:00
committed by GitHub
parent 15f606a12b
commit 0f632f2fba
+2 -2
View File
@@ -439,7 +439,7 @@ fn enter_chroot(root: &Path, skip_chdir: bool) -> UResult<()> {
let err = unsafe {
chroot(
CString::new(root.as_os_str().as_bytes().to_vec())
.unwrap()
.map_err(|e| ChrootError::CannotEnter("root".to_string(), e.into()))?
.as_bytes_with_nul()
.as_ptr()
.cast::<libc::c_char>(),
@@ -448,7 +448,7 @@ fn enter_chroot(root: &Path, skip_chdir: bool) -> UResult<()> {
if err == 0 {
if !skip_chdir {
std::env::set_current_dir("/").unwrap();
std::env::set_current_dir("/")?;
}
Ok(())
} else {