summaryrefslogtreecommitdiff
path: root/methods/aptmethod.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-06-02 12:44:58 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-06-02 13:35:28 +0200
commit62600666d21aacea63cece3b4ec64f0ffb40168b (patch)
treed453d797aa2f3708f0c33cdffdf324ee4ed6b1d4 /methods/aptmethod.h
parentaddbf58217d9aa3709c48d8821b256d726aefa5b (diff)
ignore std::locale exeception on non-existent "" locale
In 8b79c94af7f7cf2e5e5342294bc6e5a908cacabf changing to usage of C++ way of setting the locale causes us to be terminated in case of usage of an ungenerated locale as LC_ALL (or similar) – but we don't want to fail here, we just want to carry on as before with setlocale which we call in that case just for good measure.
Diffstat (limited to 'methods/aptmethod.h')
-rw-r--r--methods/aptmethod.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index cf3496e45..bef61a8bc 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -46,7 +46,11 @@ public:
aptMethod(char const * const Binary, char const * const Ver, unsigned long const Flags) :
pkgAcqMethod(Ver, Flags), Binary(Binary)
{
- std::locale::global(std::locale(""));
+ try {
+ std::locale::global(std::locale(""));
+ } catch (...) {
+ setlocale(LC_ALL, "");
+ }
}
};