Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5b16abe

Browse files
committedOct 10, 2024
Prefer target_vendor = "apple" on confstr
1 parent bc63981 commit 5b16abe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎std/src/sys/pal/unix/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ pub fn page_size() -> usize {
704704
//
705705
// [posix_confstr]:
706706
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html
707-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
707+
#[cfg(target_vendor = "apple")]
708708
fn confstr(key: c_int, size_hint: Option<usize>) -> io::Result<OsString> {
709709
let mut buf: Vec<u8> = Vec::new();
710710
let mut bytes_needed_including_nul = size_hint
@@ -765,7 +765,7 @@ fn darwin_temp_dir() -> PathBuf {
765765
pub fn temp_dir() -> PathBuf {
766766
crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
767767
cfg_if::cfg_if! {
768-
if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] {
768+
if #[cfg(target_vendor = "apple")] {
769769
darwin_temp_dir()
770770
} else if #[cfg(target_os = "android")] {
771771
PathBuf::from("/data/local/tmp")

‎std/src/sys/pal/unix/os/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn test_parse_glibc_version() {
2525
// Smoke check `confstr`, do it for several hint values, to ensure our resizing
2626
// logic is correct.
2727
#[test]
28-
#[cfg(target_os = "macos")]
28+
#[cfg(target_vendor = "apple")]
2929
fn test_confstr() {
3030
for key in [libc::_CS_DARWIN_USER_TEMP_DIR, libc::_CS_PATH] {
3131
let value_nohint = super::confstr(key, None).unwrap_or_else(|e| {

0 commit comments

Comments
 (0)
Failed to load comments.