⛏️ index : haiku.git

author Augustin Cavalier <waddlesplash@gmail.com> 2025-11-29 19:38:21.0 -05:00:00
committer Augustin Cavalier <waddlesplash@gmail.com> 2025-11-29 19:38:37.0 -05:00:00
commit
49a702dd58581694c2e8999df2fa225dad0738c4 [patch]
tree
ff56f582ef4789f4c04bc58236a175503c1641d3
parent
1f58862893cfb7cb6ec50b17913500cbf5e60edc
download
49a702dd58581694c2e8999df2fa225dad0738c4.tar.gz

libroot/locale: Only set all locales if we checked the whole set.

If we only checked one, then of course we can't set LC_ALL,
as that will override ones we didn't verify were the same.

Seems this code has been wrong since it was first imported in 2010.

Fixes #19446.

Diff

 src/system/libroot/posix/locale/LocaleInternal.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/system/libroot/posix/locale/LocaleInternal.cpp b/src/system/libroot/posix/locale/LocaleInternal.cpp
index 16d5aaf..6557133 100644
--- a/src/system/libroot/posix/locale/LocaleInternal.cpp
+++ b/src/system/libroot/posix/locale/LocaleInternal.cpp
@@ -49,6 +49,7 @@
			to = LC_LAST;
		} else
			from = to = category;

		bool haveDifferentLocales = false;
		locale = NULL;
		for (int lc = from; lc <= to; lc++) {
@@ -62,7 +63,7 @@
			if (lastLocale != NULL && strcasecmp(locale, lastLocale) != 0)
				haveDifferentLocales = true;
		}
		if (!haveDifferentLocales) {
		if (from == 1 && to == LC_LAST && !haveDifferentLocales) {
			// we can set all locales at once
			locales[LC_ALL] = locale;
		}