Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > f688fb39cfed0426a20c0bac7361c521 > files > 8

systemd-253.7-1.mga9.src.rpm

From 43f76569a2418d65a9a57e2857d173e137a836da Mon Sep 17 00:00:00 2001
From: Colin Guthrie <colin@mageia.org>
Date: Sun, 8 Feb 2015 12:47:12 +0000
Subject: [PATCH 508/509] Add path to locale search.

Mageia seems to store it's locales in /usr/share/locale (and also seems
to copy it to /etc/locale??) so add in /usr/share/locale in addition to
/usr/lib/locale. We should investigate if we 'force' the share path and
make steps to move it if it's a pointless deviation.

We should also find out why we have /etc/locale/ directory tree populated.
---
 src/basic/locale-util.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
index 266cb2993..dfced88bc 100644
--- a/src/basic/locale-util.c
+++ b/src/basic/locale-util.c
@@ -186,6 +186,32 @@ static int add_locales_from_libdir(Set *
         return 0;
 }
 
+static int add_locales_from_sharedir (Set *locales) {
+        _cleanup_closedir_ DIR *dir = NULL;
+        int r;
+
+        dir = opendir("/usr/share/locale");
+        if (!dir)
+                return errno == ENOENT ? 0 : -errno;
+
+        FOREACH_DIRENT(de, dir, return -errno) {
+                char *z;
+
+                if (de->d_type != DT_DIR)
+                        continue;
+
+                z = strdup(de->d_name);
+                if (!z)
+                        return -ENOMEM;
+
+                r = set_consume(locales, z);
+                if (r < 0 && r != -EEXIST)
+                        return r;
+        }
+
+        return 0;
+}
+
 int get_locales(char ***ret) {
         _cleanup_set_free_free_ Set *locales = NULL;
         _cleanup_strv_free_ char **l = NULL;
@@ -212,6 +238,10 @@ int get_locales(char ***ret) {
                         free(set_remove(locales, locale));
         }
 
+        r = add_locales_from_sharedir(locales);
+        if (r < 0)
+                return r;
+
         l = set_get_strv(locales);
         if (!l)
                 return -ENOMEM;