Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame^] | 1 | localedef --add-to-archive uses a hard-coded locale path which doesn't exist in |
| 2 | normal use, and there's no way to pass an alternative filename. |
| 3 | |
| 4 | Add a fallback of $LOCALEARCHIVE from the environment, and allow creation of new locale archives that are not the system archive. |
| 5 | |
| 6 | Upstream-Status: Inappropriate (OE-specific) |
| 7 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 8 | |
| 9 | diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c |
| 10 | index ca332a34..6b7ba9b2 100644 |
| 11 | --- a/locale/programs/locarchive.c |
| 12 | +++ b/locale/programs/locarchive.c |
| 13 | @@ -569,10 +569,13 @@ open_archive (struct locarhandle *ah, bool readonly) |
| 14 | /* If ah has a non-NULL fname open that otherwise open the default. */ |
| 15 | if (archivefname == NULL) |
| 16 | { |
| 17 | - archivefname = default_fname; |
| 18 | - if (output_prefix) |
| 19 | - memcpy (default_fname, output_prefix, prefix_len); |
| 20 | - strcpy (default_fname + prefix_len, ARCHIVE_NAME); |
| 21 | + archivefname = getenv("LOCALEARCHIVE"); |
| 22 | + if (archivefname == NULL) { |
| 23 | + archivefname = default_fname; |
| 24 | + if (output_prefix) |
| 25 | + memcpy (default_fname, output_prefix, prefix_len); |
| 26 | + strcpy (default_fname + prefix_len, ARCHIVE_NAME); |
| 27 | + } |
| 28 | } |
| 29 | |
| 30 | while (1) |
| 31 | @@ -585,7 +588,7 @@ open_archive (struct locarhandle *ah, bool readonly) |
| 32 | the default locale archive we ignore the failure and |
| 33 | list an empty archive, otherwise we print an error |
| 34 | and exit. */ |
| 35 | - if (errno == ENOENT && archivefname == default_fname) |
| 36 | + if (errno == ENOENT) |
| 37 | { |
| 38 | if (readonly) |
| 39 | { |