summaryrefslogtreecommitdiffstats
path: root/library/std/src/sys/unix/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:53 +0000
commit73e0a5b7696ea019ba35b89f38fc8e7b285d99cb (patch)
tree0d2e175af6f114cb50a675bec0bc76e12e1bceb4 /library/std/src/sys/unix/mod.rs
parentAdding upstream version 1.75.0+dfsg1. (diff)
downloadrustc-upstream.tar.xz
rustc-upstream.zip
Adding upstream version 1.76.0+dfsg1.upstream/1.76.0+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/std/src/sys/unix/mod.rs')
-rw-r--r--library/std/src/sys/unix/mod.rs7
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 4b28f6feb..b5da5f870 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