From 62600666d21aacea63cece3b4ec64f0ffb40168b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 2 Jun 2016 12:44:58 +0200 Subject: ignore std::locale exeception on non-existent "" locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- apt-private/private-main.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 0075f813f..d6517dd2a 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -18,7 +18,11 @@ void InitLocale(APT_CMD const binary) /*{{{*/ { - std::locale::global(std::locale("")); + try { + std::locale::global(std::locale("")); + } catch (...) { + setlocale(LC_ALL, ""); + } switch(binary) { case APT_CMD::APT: -- cgit v1.2.3-70-g09d2