-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
0001-upstream-fix-libc-removing-unsafe-on-makedev.diff
71 lines (63 loc) · 3.57 KB
/
0001-upstream-fix-libc-removing-unsafe-on-makedev.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From d96e9957e5725bb67e8ba617cb8bfe087a271ae0 Mon Sep 17 00:00:00 2001
From: ETKNeil <89385146+ETKNeil@users.noreply.github.com>
Date: Tue, 20 Sep 2022 13:39:18 +0200
Subject: [PATCH] Fix libc removing unsafe on makedev
---
Cargo.toml | 6 +++---
src/backend/libc/fs/makedev.rs | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
# diff --git a/Cargo.toml b/Cargo.toml
# index d9735cb8..dcde3702 100644
# --- a/Cargo.toml
# +++ b/Cargo.toml
# @@ -40,7 +40,7 @@ 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:
# #
# @@ -48,7 +48,7 @@ libc = { version = "0.2.126", features = ["extra_traits"], optional = true }
# # 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:
# #
# @@ -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
diff --git a/src/backend/libc/fs/makedev.rs b/src/backend/libc/fs/makedev.rs
index d9089e7f..08ecd872 100644
--- a/src/backend/libc/fs/makedev.rs
+++ b/src/backend/libc/fs/makedev.rs
@@ -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"))]
@@ -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")))]