Skip to content

Commit cc5d6b4

Browse files
ShadowCurseroypat
authored andcommitted
refactor(jailer): remove arch dependent ptr cast
There is no need to do different cast types for different platforms. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 07ccd0d commit cc5d6b4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/jailer/src/env.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,8 @@ impl Env {
463463
.map_err(|err| JailerError::Chmod(folder_path.to_owned(), err))?;
464464

465465
let c_path = CString::new(folder_path.to_str().unwrap()).unwrap();
466-
#[cfg(target_arch = "x86_64")]
467-
let folder_bytes_ptr = c_path.as_ptr().cast::<i8>();
468-
#[cfg(target_arch = "aarch64")]
469-
let folder_bytes_ptr = c_path.as_ptr();
470466
// SAFETY: This is safe because folder was checked for a null-terminator.
471-
SyscallReturnCode(unsafe { libc::chown(folder_bytes_ptr, self.uid(), self.gid()) })
467+
SyscallReturnCode(unsafe { libc::chown(c_path.as_ptr(), self.uid(), self.gid()) })
472468
.into_empty_result()
473469
.map_err(|err| JailerError::ChangeFileOwner(folder_path.to_owned(), err))
474470
}

0 commit comments

Comments
 (0)