use a consistent ERANGE message

The previous change neglected to consider that numbers too large for the
long long datatype will result in calling strerror(ERANGE) whose return
value can vary depending on the platform. Which breaks the unit test.
This commit is contained in:
Kurtis Rader 2017-02-20 18:43:13 -08:00
parent 3d0a377e26
commit 992e1d0059
2 changed files with 6 additions and 2 deletions

View file

@ -240,7 +240,11 @@ void builtin_printf_state_t::append_format_output(const wchar_t *fmt, ...) {
void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end, int errcode) {
if (errcode != 0) {
this->fatal_error(L"%ls: %s", s, strerror(errcode));
if (errcode == ERANGE) {
this->fatal_error(L"%ls: %ls", s, _(L"Number out of range"));
} else {
this->fatal_error(L"%ls: %s", s, strerror(errcode));
}
} else if (*end) {
if (s == end)
this->fatal_error(_(L"%ls: expected a numeric value"), s);

View file

@ -1,2 +1,2 @@
2,34: value not completely converted
0xABCDEF12345678901: Result too large
0xABCDEF12345678901: Number out of range