summaryrefslogtreecommitdiff
path: root/string/xpg-strerror.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2010-12-25 13:56:48 -0500
committerUlrich Drepper <drepper@gmail.com>2010-12-25 13:56:48 -0500
commit98727dbea212799beb7a15eeb9a21c8c5d100267 (patch)
treec265c48eaf3a67cc1d8dc54c487c84285bcdc0bd /string/xpg-strerror.c
parent8bdf4e6eb88d2174ccf20c7180658fd9e816a7d8 (diff)
Change XPG-compliant strerror_r function to return error code.
Diffstat (limited to 'string/xpg-strerror.c')
-rw-r--r--string/xpg-strerror.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/string/xpg-strerror.c b/string/xpg-strerror.c
index 5cb56cdfb8..8d898122d1 100644
--- a/string/xpg-strerror.c
+++ b/string/xpg-strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -39,18 +39,13 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
{
if (errnum < 0 || errnum >= _sys_nerr_internal
|| _sys_errlist_internal[errnum] == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ return EINVAL;
+
const char *estr = (const char *) _(_sys_errlist_internal[errnum]);
size_t estrlen = strlen (estr) + 1;
if (buflen < estrlen)
- {
- __set_errno (ERANGE);
- return -1;
- }
+ return ERANGE;
memcpy (buf, estr, estrlen);
return 0;