mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
hostname: reduce range of unsafe
This commit is contained in:
@@ -38,10 +38,8 @@ mod wsa {
|
||||
pub(super) struct WsaHandle(());
|
||||
|
||||
pub(super) fn start() -> io::Result<WsaHandle> {
|
||||
let err = unsafe {
|
||||
let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
|
||||
WSAStartup(0x0202, data.as_mut_ptr())
|
||||
};
|
||||
let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
|
||||
let err = unsafe { WSAStartup(0x0202, data.as_mut_ptr()) };
|
||||
if err == 0 {
|
||||
Ok(WsaHandle(()))
|
||||
} else {
|
||||
@@ -51,10 +49,8 @@ mod wsa {
|
||||
|
||||
impl Drop for WsaHandle {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
// This possibly returns an error but we can't handle it
|
||||
let _err = WSACleanup();
|
||||
}
|
||||
// This possibly returns an error but we can't handle it
|
||||
let _ = unsafe { WSACleanup() };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user