freebsd-ports/shells/fish/files/patch-src_fallback.cpp
Alan Somers facd31f44f shells/fish: patch upstream issue #5453
This change fixes a segfault that would happen from operations like
'printf "%f" 7.0'.  Also, this change removes Python as a runtime
dependency.  That was supposed to have been done in r488840, but there was a
typo.

https://github.com/fish-shell/fish-shell/issues/5453

Reported by:	Mahmoud Al-Qudsi <mqudsi@neosmart.net>
MFH:		2019Q1
2019-01-17 20:40:43 +00:00

16 lines
681 B
C++

--- src/fallback.cpp
+++ src/fallback.cpp
@@ -390,9 +390,10 @@ int flock(int fd, int op) {
#endif // HAVE_FLOCK
#ifndef HAVE_WCSTOD_L
-// musl doesn't feature wcstod_l,
-// so we just wrap wcstod.
-double wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) {
+#undef wcstod_l
+// For platforms without wcstod_l C extension, wrap wcstod after changing the
+// thread-specific locale.
+double fish_compat::wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) {
char *saved_locale = strdup(setlocale(LC_NUMERIC, NULL));
// Yes, this is hardcoded to use the "C" locale.
// That's the only thing we need, and uselocale(loc) broke in my testing.