diff options
| author | klensy <klensy@users.noreply.github.com> | 2023-12-03 14:24:25 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2023-12-03 14:54:09 +0300 |
| commit | c0134887d2b4cbac421babcd40710cc9b755f931 (patch) | |
| tree | 56c561ba3efec455f8e5da17a7c018f71e8de4e7 /library/std/src/sys/unix/mod.rs | |
| parent | 26e69a88167bd68ad65b22d5ca013f1270b163be (diff) | |
| download | rust-c0134887d2b4cbac421babcd40710cc9b755f931.tar.gz rust-c0134887d2b4cbac421babcd40710cc9b755f931.zip | |
library: use c string literals
Diffstat (limited to 'library/std/src/sys/unix/mod.rs')
| -rw-r--r-- | library/std/src/sys/unix/mod.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 4b28f6feba5..b5da5f870ec 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -1,6 +1,5 @@ #![allow(missing_docs, nonstandard_style)] -use crate::ffi::CStr; use crate::io::ErrorKind; pub use self::rand::hashmap_random_keys; @@ -75,7 +74,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { // thread-id for the main thread and so renaming the main thread will rename the // process and we only want to enable this on platforms we've tested. if cfg!(target_os = "macos") { - thread::Thread::set_name(&CStr::from_bytes_with_nul_unchecked(b"main\0")); + thread::Thread::set_name(&c"main"); } unsafe fn sanitize_standard_fds() { @@ -127,7 +126,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { if pfd.revents & libc::POLLNVAL == 0 { continue; } - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // 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) { use libc::open64; for fd in 0..3 { if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF { - if open64("/dev/null\0".as_ptr().cast(), libc::O_RDWR, 0) == -1 { + if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { // If the stream is closed but we failed to reopen it, abort the // process. Otherwise we wouldn't preserve the safety of // operations on the corresponding Rust object Stdin, Stdout, or |
