|
1 | 1 | #![allow(missing_docs, nonstandard_style)]
|
2 | 2 |
|
3 |
| -use crate::ffi::CStr; |
4 | 3 | use crate::io::ErrorKind;
|
5 | 4 |
|
6 | 5 | pub use self::rand::hashmap_random_keys;
|
@@ -75,7 +74,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
75 | 74 | // thread-id for the main thread and so renaming the main thread will rename the
|
76 | 75 | // process and we only want to enable this on platforms we've tested.
|
77 | 76 | if cfg!(target_os = "macos") {
|
78 |
| - thread::Thread::set_name(&CStr::from_bytes_with_nul_unchecked(b"main\0")); |
| 77 | + thread::Thread::set_name(&c"main"); |
79 | 78 | }
|
80 | 79 |
|
81 | 80 | unsafe fn sanitize_standard_fds() {
|
@@ -127,7 +126,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
127 | 126 | if pfd.revents & libc::POLLNVAL == 0 {
|
128 | 127 | continue;
|
129 | 128 | }
|
130 |
| - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { |
| 129 | + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { |
131 | 130 | // If the stream is closed but we failed to reopen it, abort the
|
132 | 131 | // process. Otherwise we wouldn't preserve the safety of
|
133 | 132 | // operations on the corresponding Rust object Stdin, Stdout, or
|
@@ -157,7 +156,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
157 | 156 | use libc::open64;
|
158 | 157 | for fd in 0..3 {
|
159 | 158 | if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF {
|
160 |
| - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { |
| 159 | + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { |
161 | 160 | // If the stream is closed but we failed to reopen it, abort the
|
162 | 161 | // process. Otherwise we wouldn't preserve the safety of
|
163 | 162 | // operations on the corresponding Rust object Stdin, Stdout, or
|
|
0 commit comments