1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

chroot: remove unwrap calls (#7890)

This commit is contained in:
jovie :) 2025-05-28 01:29:19 -06:00 committed by GitHub
parent 15f606a12b
commit 0f632f2fba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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 {