teknoraver / rpms / systemd

Forked from rpms/systemd a month ago
Clone

Blame SOURCES/0216-locale-util-check-if-enumerated-locales-are-valid.patch

594167
From c10efc8164dcdf8596315ce98f60405f8c2e17c0 Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Tue, 14 Jun 2022 09:05:00 +0900
594167
Subject: [PATCH] locale-util: check if enumerated locales are valid
594167
594167
(cherry picked from commit a2f7937747f12634d93049f645cdae88f89ff233)
594167
594167
Related: #2087652
594167
---
594167
 src/basic/locale-util.c | 9 +++++++++
594167
 1 file changed, 9 insertions(+)
594167
594167
diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
594167
index abbebc7666..bd36cdd1cd 100644
594167
--- a/src/basic/locale-util.c
594167
+++ b/src/basic/locale-util.c
594167
@@ -199,6 +199,15 @@ int get_locales(char ***ret) {
594167
         if (r < 0)
594167
                 return r;
594167
 
594167
+        char *locale;
594167
+        SET_FOREACH(locale, locales) {
594167
+                r = locale_is_installed(locale);
594167
+                if (r < 0)
594167
+                        return r;
594167
+                if (r == 0)
594167
+                        free(set_remove(locales, locale));
594167
+        }
594167
+
594167
         l = set_get_strv(locales);
594167
         if (!l)
594167
                 return -ENOMEM;