Remove unnecessary unsafe block in process_unix

This commit is contained in:
Léo Lanteri Thauvin
2021-08-24 10:07:16 +02:00
parent f66e825f73
commit 22112e4390

View File

@@ -552,8 +552,7 @@ impl Process {
use crate::os::unix::io::FromRawFd;
use crate::sys_common::FromInner;
// Safety: If `pidfd` is nonnegative, we assume it's valid and otherwise unowned.
let pidfd = (pidfd >= 0)
.then(|| PidFd::from_inner(unsafe { sys::fd::FileDesc::from_raw_fd(pidfd) }));
let pidfd = (pidfd >= 0).then(|| PidFd::from_inner(sys::fd::FileDesc::from_raw_fd(pidfd)));
Process { pid, status: None, pidfd }
}