]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale-util: filter out non-UTF-8 locales even when failed to parse $SYSTEMD_LIST_NON...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 11 Apr 2025 00:13:39 +0000 (09:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 12 Apr 2025 19:59:26 +0000 (04:59 +0900)
src/basic/locale-util.c

index 45ba70f04d710f93106a9e7ff357d78877fcf840..3fb9540f45bf43061c12a15718c4966dceb786fe 100644 (file)
@@ -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);