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:
parent
15f606a12b
commit
0f632f2fba
1 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue