diff --git a/src/env/environment.rs b/src/env/environment.rs index 725a17abd..8fe2edf08 100644 --- a/src/env/environment.rs +++ b/src/env/environment.rs @@ -27,7 +27,7 @@ use crate::wcstringutil::join_strings; use crate::wutil::{fish_wcstol, wgetcwd, wgettext}; use std::sync::atomic::Ordering; -use libc::{c_int, uid_t, STDOUT_FILENO, _IONBF}; +use libc::{c_int, confstr, uid_t, STDOUT_FILENO, _IONBF}; use once_cell::sync::OnceCell; use std::collections::HashMap; use std::ffi::CStr; @@ -568,7 +568,7 @@ fn setup_user(vars: &EnvStack) { /// Make sure the PATH variable contains something. fn setup_path() { - use crate::libc::{confstr, _CS_PATH}; + use crate::libc::_CS_PATH; let vars = EnvStack::globals(); let path = vars.get_unless_empty(L!("PATH")); diff --git a/src/libc.c b/src/libc.c index 93183e5a1..97bd2218e 100644 --- a/src/libc.c +++ b/src/libc.c @@ -19,21 +19,6 @@ uint64_t C_ST_LOCAL() { #endif } -// confstr + _CS_PATH is only available on macOS with rust's libc -// we could just declare extern "C" confstr directly in Rust -// that would panic if it failed to link, which C++ did not -// therefore we define a backup, which just returns an error -// which for confstr is 0 -#if defined(_CS_PATH) -#else -size_t confstr(int name, char* buf, size_t size) { - UNUSED(name); - UNUSED(buf); - UNUSED(size); - return 0; -} -#endif - int C_CS_PATH() { #if defined(_CS_PATH) return _CS_PATH; diff --git a/src/libc.rs b/src/libc.rs index 6269f0f7d..3ddb0bee0 100644 --- a/src/libc.rs +++ b/src/libc.rs @@ -14,11 +14,6 @@ extern "C" { } extern "C" { - pub(crate) fn confstr( - name: libc::c_int, - buf: *mut libc::c_char, - len: libc::size_t, - ) -> libc::size_t; pub fn stdout_stream() -> *mut libc::FILE; pub fn setlinebuf(stream: *mut libc::FILE); }