Message ID | 20200217205843.2081014-2-mc5686@mclink.it |
---|---|
State | Accepted |
Headers | show |
Series | Support systems without locale in toolchain | expand |
Hi Mauro, On 17/02/20 21:58, Mauro Condarelli wrote: > Signed-off-by: Mauro Condarelli <mc5686@mclink.it> > --- > handlers/Config.in | 8 ++++++++ > handlers/archive_handler.c | 6 ++++++ > 2 files changed, 14 insertions(+) > > diff --git a/handlers/Config.in b/handlers/Config.in > index bf14303..a9cbcf4 100644 > --- a/handlers/Config.in > +++ b/handlers/Config.in > @@ -186,6 +186,14 @@ config ARCHIVE > > comment "archive support needs libarchive" > depends on !HAVE_LIBARCHIVE > + > +config LOCALE > + bool "Locale support for filenames" > + depends on ARCHIVE > + default y > + help > + Option to remove attempts to use locale in systems > + without locale support in toolchain. > > config REMOTE_HANDLER > bool "Remote handler" > diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c > index 993bc10..b797277 100644 > --- a/handlers/archive_handler.c > +++ b/handlers/archive_handler.c > @@ -69,8 +69,10 @@ copy_data(struct archive *ar, struct archive *aw) > static void * > extract(void *p) > { > +#ifdef CONFIG_LOCALE > locale_t archive_locale; > locale_t old_locale; > +#endif > struct archive *a; > struct archive *ext = NULL; > struct archive_entry *entry = NULL; > @@ -80,6 +82,7 @@ extract(void *p) > flags = data->flags; > int exitval = -EFAULT; > > +#ifdef CONFIG_LOCALE > /* > * Enable system locale - change from the standard (C) to system locale. > * This allows libarchive (in case it is activated) to handle filenames. > @@ -93,6 +96,7 @@ extract(void *p) > */ > archive_locale = newlocale(LC_CTYPE_MASK, "", (locale_t)0); > old_locale = uselocale(archive_locale); > +#endif > > a = archive_read_new(); > if (!a) { > @@ -172,7 +176,9 @@ out: > archive_read_free(a); > } > > +#ifdef CONFIG_LOCALE > uselocale(old_locale); > +#endif > data->exitval = exitval; > pthread_exit(NULL); > } > Looks fine. Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic
diff --git a/handlers/Config.in b/handlers/Config.in index bf14303..a9cbcf4 100644 --- a/handlers/Config.in +++ b/handlers/Config.in @@ -186,6 +186,14 @@ config ARCHIVE comment "archive support needs libarchive" depends on !HAVE_LIBARCHIVE + +config LOCALE + bool "Locale support for filenames" + depends on ARCHIVE + default y + help + Option to remove attempts to use locale in systems + without locale support in toolchain. config REMOTE_HANDLER bool "Remote handler" diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c index 993bc10..b797277 100644 --- a/handlers/archive_handler.c +++ b/handlers/archive_handler.c @@ -69,8 +69,10 @@ copy_data(struct archive *ar, struct archive *aw) static void * extract(void *p) { +#ifdef CONFIG_LOCALE locale_t archive_locale; locale_t old_locale; +#endif struct archive *a; struct archive *ext = NULL; struct archive_entry *entry = NULL; @@ -80,6 +82,7 @@ extract(void *p) flags = data->flags; int exitval = -EFAULT; +#ifdef CONFIG_LOCALE /* * Enable system locale - change from the standard (C) to system locale. * This allows libarchive (in case it is activated) to handle filenames. @@ -93,6 +96,7 @@ extract(void *p) */ archive_locale = newlocale(LC_CTYPE_MASK, "", (locale_t)0); old_locale = uselocale(archive_locale); +#endif a = archive_read_new(); if (!a) { @@ -172,7 +176,9 @@ out: archive_read_free(a); } +#ifdef CONFIG_LOCALE uselocale(old_locale); +#endif data->exitval = exitval; pthread_exit(NULL); }
Signed-off-by: Mauro Condarelli <mc5686@mclink.it> --- handlers/Config.in | 8 ++++++++ handlers/archive_handler.c | 6 ++++++ 2 files changed, 14 insertions(+)