Skip to content

Fix libc removing unsafe on makedev #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ once_cell = { version = "1.5.2", optional = true }
[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"), all(target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64")))))'.dependencies]
linux-raw-sys = { version = "0.0.46", default-features = false, features = ["general", "errno", "ioctl", "no_std"] }
libc_errno = { package = "errno", version = "0.2.8", default-features = false, optional = true }
libc = { version = "0.2.126", features = ["extra_traits"], optional = true }
libc = { version = "0.2.133", features = ["extra_traits"], optional = true }

# Dependencies for platforms where only libc is supported:
#
# On all other Unix-family platforms, and under Miri, we always use the libc
# backend, so enable its dependencies unconditionally.
[target.'cfg(any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"), all(target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64")))))))'.dependencies]
libc_errno = { package = "errno", version = "0.2.8", default-features = false }
libc = { version = "0.2.126", features = ["extra_traits"] }
libc = { version = "0.2.133", features = ["extra_traits"] }

# Additional dependencies for Linux with the libc backend:
#
Expand All @@ -69,7 +69,7 @@ features = [

[dev-dependencies]
tempfile = "3.2.0"
libc = "0.2.126"
libc = "0.2.133"
libc_errno = { package = "errno", version = "0.2.8", default-features = false }
io-lifetimes = { version = "1.0.0-rc1", default-features = false }
# Don't upgrade to serial_test 0.7 for now because it depends on a
Expand Down
6 changes: 3 additions & 3 deletions src/backend/libc/fs/makedev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use crate::fs::Dev;
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
unsafe { c::makedev(maj, min) }
c::makedev(maj, min)
}

#[cfg(all(target_os = "android", not(target_pointer_width = "32")))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
// Android's `makedev` oddly has signed argument types.
unsafe { c::makedev(maj as i32, min as i32) }
c::makedev(maj, min)
}

#[cfg(all(target_os = "android", target_pointer_width = "32"))]
Expand All @@ -30,7 +30,7 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
// Emscripten's `makedev` has a 32-bit return value.
Dev::from(unsafe { c::makedev(maj, min) })
Dev::from(c::makedev(maj, min))
}

#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
Expand Down