From: Yu Watanabe Date: Fri, 11 Apr 2025 00:13:39 +0000 (+0900) Subject: locale-util: filter out non-UTF-8 locales even when failed to parse $SYSTEMD_LIST_NON... X-Git-Tag: v258-rc1~829^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4a5ee4cd1ce28a8ed4bbb211b4909f0bfa96438;p=thirdparty%2Fsystemd.git locale-util: filter out non-UTF-8 locales even when failed to parse $SYSTEMD_LIST_NON_UTF8_LOCALES --- diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index 45ba70f04d7..3fb9540f45b 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -220,7 +220,10 @@ int get_locales(char ***ret) { locales = set_free(locales); r = getenv_bool("SYSTEMD_LIST_NON_UTF8_LOCALES"); - if (IN_SET(r, -ENXIO, 0)) { + if (r <= 0) { + if (!IN_SET(r, -ENXIO, 0)) + log_debug_errno(r, "Failed to parse $SYSTEMD_LIST_NON_UTF8_LOCALES as boolean, ignoring: %m"); + char **a, **b; /* Filter out non-UTF-8 locales, because it's 2019, by default */ @@ -234,9 +237,7 @@ int get_locales(char ***ret) { } *b = NULL; - - } else if (r < 0) - log_debug_errno(r, "Failed to parse $SYSTEMD_LIST_NON_UTF8_LOCALES as boolean"); + } strv_sort(l);