glibc/glibc-2.3.90-langpackdir.diff
Andreas Schwab 840aeb3750 Accepting request 434696 from home:Andreas_Schwab:Factory
- cpuid-assertion.patch: Don't assert on older Intel CPUs (BZ #20647)

- glibc-2.3.3-nscd-db-path.diff: Move persistent nscd databases to
  /var/lib/nscd
- glibc-2.3.90-langpackdir.diff: simplify

OBS-URL: https://build.opensuse.org/request/show/434696
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=447
2016-10-13 09:25:07 +00:00

55 lines
1.7 KiB
Diff

Index: glibc-2.24/intl/loadmsgcat.c
===================================================================
--- glibc-2.24.orig/intl/loadmsgcat.c
+++ glibc-2.24/intl/loadmsgcat.c
@@ -829,8 +829,47 @@ _nl_load_domain (struct loaded_l10nfile
if (domain_file->filename == NULL)
goto out;
- /* Try to open the addressed file. */
- fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+ /* 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);
+ fd = open (filename_langpack, O_RDONLY | O_BINARY);
+ }
+
+ free (filename_langpack);
+ }
+
+ if (fd == -1)
+ /* Try to open the addressed file. */
+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+
+ 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 | O_BINARY);
+ }
+
+ free (filename_bundle);
+ }
+ }
+
if (fd == -1)
goto out;