mirror of git://gcc.gnu.org/git/gcc.git
PR 67414 Handle newlocale failure
2015-09-02 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/67414 * runtime/error.c (gf_strerror): Handle newlocale() failure. From-SVN: r227406
This commit is contained in:
parent
e4770825f9
commit
51926fab48
|
|
@ -1,3 +1,8 @@
|
|||
2015-09-02 Janne Blomqvist <jb@gcc.gnu.org>
|
||||
|
||||
PR libfortran/67414
|
||||
* runtime/error.c (gf_strerror): Handle newlocale() failure.
|
||||
|
||||
2015-08-28 James Greenhalgh <james.greenhalgh@arm.com>
|
||||
|
||||
* configure.ac: Define HAVE_FTRUNCATE for ARM/AArch64/SH newlib
|
||||
|
|
|
|||
|
|
@ -221,8 +221,16 @@ gf_strerror (int errnum,
|
|||
#ifdef HAVE_STRERROR_L
|
||||
locale_t myloc = newlocale (LC_CTYPE_MASK | LC_MESSAGES_MASK, "",
|
||||
(locale_t) 0);
|
||||
char *p = strerror_l (errnum, myloc);
|
||||
freelocale (myloc);
|
||||
char *p;
|
||||
if (myloc)
|
||||
{
|
||||
p = strerror_l (errnum, myloc);
|
||||
freelocale (myloc);
|
||||
}
|
||||
else
|
||||
/* newlocale might fail e.g. due to running out of memory, fall
|
||||
back to the simpler strerror. */
|
||||
p = strerror (errnum);
|
||||
return p;
|
||||
#elif defined(HAVE_STRERROR_R)
|
||||
#ifdef HAVE_USELOCALE
|
||||
|
|
|
|||
Loading…
Reference in New Issue