Skip to content

Commit

Permalink
float_to_lstring(): do not crash when glibc-locale is missing
Browse files Browse the repository at this point in the history
fallback to unlocalized version (bnc#803163)
  • Loading branch information
lslezak committed Oct 15, 2013
1 parent ae6daa1 commit 7d034e4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.1.0
3.1.1
7 changes: 7 additions & 0 deletions package/yast2-ruby-bindings.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Oct 15 13:01:18 UTC 2013 - lslezak@suse.cz

- float_to_lstring(): do not crash when glibc-locale is missing,
fallback to unlocalized version (bnc#803163)
- 3.1.1

-------------------------------------------------------------------
Thu Sep 12 07:53:00 UTC 2013 - jreidinger@suse.com

Expand Down
12 changes: 11 additions & 1 deletion src/binary/Builtin.cc
Expand Up @@ -8,6 +8,7 @@

#include <string>
#include <sstream>
#include <stdexcept>
#include <iconv.h>
#include <errno.h>
extern "C" {
Expand Down Expand Up @@ -163,7 +164,16 @@ extern "C" {
return Qnil;

std::wostringstream ss; // bnc#683881#c12: need wide chars
ss.imbue (std::locale (""));

try
{
ss.imbue (std::locale (""));
}
catch (const std::runtime_error &error)
{
y2warning("Cannot set locale (missing glibc-locale package?): %s", error.what());
}

ss.precision (NUM2LONG(rprecision));
ss << fixed<< NUM2DBL(rfloat);
std::wstring res = ss.str();
Expand Down

0 comments on commit 7d034e4

Please sign in to comment.