lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v192 114 lines 3.6 kB view raw
1diff -ru glibc-2.16.0-orig/locale/loadarchive.c glibc-2.16.0/locale/loadarchive.c 2--- glibc-2.16.0-orig/locale/loadarchive.c 2012-06-30 15:12:34.000000000 -0400 3+++ glibc-2.16.0/locale/loadarchive.c 2012-09-18 11:57:57.277515212 -0400 4@@ -123,6 +123,25 @@ 5 } 6 7 8+static int 9+open_locale_archive (void) 10+{ 11+ int fd = -1; 12+ char *path = getenv ("LOCALE_ARCHIVE_2_11"); 13+ char *path2 = getenv ("LOCALE_ARCHIVE"); 14+ const char *usualpath = "/usr/lib/locale/locale-archive"; 15+ if (path) 16+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE|O_CLOEXEC); 17+ if (path2 && fd < 0) 18+ fd = open_not_cancel_2 (path2, O_RDONLY|O_LARGEFILE|O_CLOEXEC); 19+ if (fd < 0) 20+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC); 21+ if (fd < 0) 22+ fd = open_not_cancel_2 (usualpath, O_RDONLY|O_LARGEFILE|O_CLOEXEC); 23+ return fd; 24+} 25+ 26+ 27 /* Find the locale *NAMEP in the locale archive, and return the 28 internalized data structure for its CATEGORY data. If this locale has 29 already been loaded from the archive, just returns the existing data 30@@ -202,7 +221,7 @@ 31 archmapped = &headmap; 32 33 /* The archive has never been opened. */ 34- fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC); 35+ fd = open_locale_archive (); 36 if (fd < 0) 37 /* Cannot open the archive, for whatever reason. */ 38 return NULL; 39@@ -393,8 +412,7 @@ 40 if (fd == -1) 41 { 42 struct stat64 st; 43- fd = open_not_cancel_2 (archfname, 44- O_RDONLY|O_LARGEFILE|O_CLOEXEC); 45+ fd = open_locale_archive (); 46 if (fd == -1) 47 /* Cannot open the archive, for whatever reason. */ 48 return NULL; 49diff -ru glibc-2.16.0-orig/locale/programs/locale.c glibc-2.16.0/locale/programs/locale.c 50--- glibc-2.16.0-orig/locale/programs/locale.c 2012-06-30 15:12:34.000000000 -0400 51+++ glibc-2.16.0/locale/programs/locale.c 2012-09-18 11:53:03.719920947 -0400 52@@ -628,6 +628,20 @@ 53 ((const struct nameent *) b)->name); 54 } 55 56+static int 57+open_nix_locale_archive (const char * fname, int access) 58+{ 59+ int fd = -1; 60+ char *path = getenv ("LOCALE_ARCHIVE_2_11"); 61+ char *path2 = getenv ("LOCALE_ARCHIVE"); 62+ if (path) 63+ fd = open64 (path, access); 64+ if (path2 && fd < 0) 65+ fd = open64 (path2, access); 66+ if (fd < 0) 67+ fd = open64 (fname, access); 68+ return fd; 69+} 70 71 static int 72 write_archive_locales (void **all_datap, char *linebuf) 73@@ -641,7 +655,7 @@ 74 int fd, ret = 0; 75 uint32_t cnt; 76 77- fd = open64 (ARCHIVE_NAME, O_RDONLY); 78+ fd = open_nix_locale_archive (ARCHIVE_NAME, O_RDONLY); 79 if (fd < 0) 80 return 0; 81 82diff -ru glibc-2.16.0-orig/locale/programs/locarchive.c glibc-2.16.0/locale/programs/locarchive.c 83--- glibc-2.16.0-orig/locale/programs/locarchive.c 2012-06-30 15:12:34.000000000 -0400 84+++ glibc-2.16.0/locale/programs/locarchive.c 2012-09-18 11:53:03.720920942 -0400 85@@ -509,6 +509,20 @@ 86 *ah = new_ah; 87 } 88 89+static int 90+open_nix_locale_archive (const char * fname, int access) 91+{ 92+ int fd = -1; 93+ char *path = getenv ("LOCALE_ARCHIVE_2_11"); 94+ char *path2 = getenv ("LOCALE_ARCHIVE"); 95+ if (path) 96+ fd = open64 (path, access); 97+ if (path2 && fd < 0) 98+ fd = open64 (path2, access); 99+ if (fd < 0) 100+ fd = open64 (fname, access); 101+ return fd; 102+} 103 104 void 105 open_archive (struct locarhandle *ah, bool readonly) 106@@ -528,7 +542,7 @@ 107 while (1) 108 { 109 /* Open the archive. We must have exclusive write access. */ 110- fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR); 111+ fd = open_nix_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR); 112 if (fd == -1) 113 { 114 /* Maybe the file does not yet exist. */