forked from pool/glibc
a30da1c424
Update to latest 2.16 git head OBS-URL: https://build.opensuse.org/request/show/131848 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=208
60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
Index: glibc-2.15.90/intl/loadmsgcat.c
|
|
===================================================================
|
|
--- glibc-2.15.90.orig/intl/loadmsgcat.c
|
|
+++ glibc-2.15.90/intl/loadmsgcat.c
|
|
@@ -805,8 +805,52 @@ _nl_load_domain (domain_file, domainbind
|
|
if (domain_file->filename == NULL)
|
|
goto out;
|
|
|
|
- /* Try to open the addressed file. */
|
|
- fd = open (domain_file->filename, O_RDONLY);
|
|
+ /* Replace /locale/ with /usr/share/locale-langpack/ */
|
|
+ const char *langpackdir = "/usr/share/locale-langpack/";
|
|
+ char *filename_langpack = malloc (strlen (domain_file->filename) +
|
|
+ strlen (langpackdir));
|
|
+ if (filename_langpack != NULL)
|
|
+ {
|
|
+ char *p = strstr (domain_file->filename, "/locale/");
|
|
+ if (p != NULL)
|
|
+ {
|
|
+ strcpy (filename_langpack, langpackdir);
|
|
+ strcpy (&filename_langpack[strlen (langpackdir)],
|
|
+ (p+8));
|
|
+ if ((fd = open (filename_langpack, O_RDONLY)) == -1)
|
|
+ fd = open (domain_file->filename, O_RDONLY);
|
|
+ }
|
|
+ else
|
|
+ /* Try to open the addressed file. */
|
|
+ fd = open (domain_file->filename, O_RDONLY);
|
|
+
|
|
+ free (filename_langpack);
|
|
+ }
|
|
+ else
|
|
+ /* Try to open the addressed file. */
|
|
+ fd = open (domain_file->filename, O_RDONLY);
|
|
+
|
|
+ if (fd == -1)
|
|
+ {
|
|
+ /* Use the fallback directory. */
|
|
+ const char *bundle_dir = "/usr/share/locale-bundle/";
|
|
+ char *filename_bundle = malloc (strlen (domain_file->filename) +
|
|
+ strlen (bundle_dir));
|
|
+ if (filename_bundle != NULL)
|
|
+ {
|
|
+ char *p = strstr (domain_file->filename, "/locale/");
|
|
+ if (p != NULL)
|
|
+ {
|
|
+ strcpy (filename_bundle, bundle_dir);
|
|
+ strcpy (&filename_bundle[strlen (bundle_dir)],
|
|
+ (p+8));
|
|
+ fd = open (filename_bundle, O_RDONLY);
|
|
+ }
|
|
+
|
|
+ free (filename_bundle);
|
|
+ }
|
|
+ }
|
|
+
|
|
if (fd == -1)
|
|
goto out;
|
|
|