diff --git a/src/env_dispatch.rs b/src/env_dispatch.rs index ff1812ddc..fd8bcc881 100644 --- a/src/env_dispatch.rs +++ b/src/env_dispatch.rs @@ -534,11 +534,6 @@ fn init_locale(vars: &EnvStack) { loc }; - // We *always* use a C-locale for numbers because we want '.' (except for in printf). - let loc_ptr = unsafe { libc::setlocale(libc::LC_NUMERIC, c"C".as_ptr()) }; - // should never fail, the C locale should always be defined - assert_ne!(loc_ptr, ptr::null_mut()); - // Update cached locale information. crate::common::fish_setlocale(); FLOG!( diff --git a/src/locale.rs b/src/locale.rs index 300b0d1d7..2fd1fa555 100644 --- a/src/locale.rs +++ b/src/locale.rs @@ -108,18 +108,8 @@ unsafe fn read_locale() -> Option { // Bleh, we have to go through localeconv, which races with setlocale. // TODO: There has to be a better way to do this. let _guard = LOCALE_LOCK.lock().unwrap(); - - unsafe { - libc::setlocale(libc::LC_NUMERIC, c"".as_ptr()); - } - let lconv = unsafe { libc::localeconv() }; - let result = (!lconv.is_null()).then(|| unsafe { lconv_to_locale(&*lconv) }); - // Note we *always* use a C-locale for numbers, because we always want "." except for in printf. - unsafe { - libc::setlocale(libc::LC_NUMERIC, c"C".as_ptr()); - } - result + (!lconv.is_null()).then(|| unsafe { lconv_to_locale(&*lconv) }) } // Current numeric locale.