summaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-23 08:34:06 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-23 08:34:06 +0000
commita8d8f72370f62b7bc9346104d1af4e2444e8cd2c (patch)
treed08f712df5fe7cd79a42d70f17fd6a12386816f3 /libgfortran/runtime
parent2be3f9fe93f32957a15e8a27d3f702443dd5f362 (diff)
downloadgcc-a8d8f72370f62b7bc9346104d1af4e2444e8cd2c.tar.gz
2012-05-23 Tobias Burnus <burnus@net-b.de>
PR libfortran/53444 * acinclude.m4 (LIBGFOR_CHECK_STRERROR_R): Add configure checks * for two- and three-argument versions of strerror_r. * configure.ac (LIBGFOR_CHECK_STRERROR_R): Use it. * runtime/error.c (gf_strerror): Handle two-argument version of strerror_r. * config.h.in: Regenerate. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187796 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/error.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index 7e523bc9a57..3955e44cea0 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -212,6 +212,7 @@ gf_strerror (int errnum,
size_t buflen __attribute__((unused)))
{
#ifdef HAVE_STRERROR_R
+ /* POSIX returns an "int", GNU a "char*". */
return
__builtin_choose_expr (__builtin_classify_type (strerror_r (0, buf, 0))
== 5,
@@ -219,6 +220,9 @@ gf_strerror (int errnum,
strerror_r (errnum, buf, buflen),
/* POSIX strerror_r () */
(strerror_r (errnum, buf, buflen), buf));
+#elif defined(HAVE_STRERROR_R_2ARGS)
+ strerror_r (errnum, buf);
+ return buf;
#else
/* strerror () is not necessarily thread-safe, but should at least
be available everywhere. */