This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.12-240-g98727db


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  98727dbea212799beb7a15eeb9a21c8c5d100267 (commit)
      from  8bdf4e6eb88d2174ccf20c7180658fd9e816a7d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=98727dbea212799beb7a15eeb9a21c8c5d100267

commit 98727dbea212799beb7a15eeb9a21c8c5d100267
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat Dec 25 13:56:48 2010 -0500

    Change XPG-compliant strerror_r function to return error code.

diff --git a/ChangeLog b/ChangeLog
index 497de67..c29dd53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-25  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12204]
+	* string/xpg-strerror.c (__xpg_strerror_r): Return error code, not -1.
+	* sysdeps/mach/xpg-strerror.c (__xpg_strerror_r): Likewise.
+
 2010-12-15  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config.h.in (NO_CTORS_DTORS_SECTIONS): Define.
diff --git a/string/xpg-strerror.c b/string/xpg-strerror.c
index 5cb56cd..8d89812 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;
diff --git a/sysdeps/mach/xpg-strerror.c b/sysdeps/mach/xpg-strerror.c
index 8d0b31e..efaf0be 100644
--- a/sysdeps/mach/xpg-strerror.c
+++ b/sysdeps/mach/xpg-strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -53,30 +53,21 @@ __xpg_strerror_r (int errnum, char *buf, size_t buflen)
   code = err_get_code (errnum);
 
   if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
+    return EINVAL;
 
   es = &__mach_error_systems[system];
 
   if (sub >= es->max_sub)
     estr = (const char *) es->bad_sub;
   else if (code >= es->subsystem[sub].max_code)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
+    return EINVAL;
   else
     estr = (const char *) _(es->subsystem[sub].codes[code]);
 
   size_t estrlen = strlen (estr) + 1;
 
   if (buflen < estrlen)
-    {
-      __set_errno (ERANGE);
-      return -1;
-    }
+    return ERANGE;
 
   memcpy (buf, estr, estrlen);
   return 0;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    6 ++++++
 string/xpg-strerror.c       |   13 ++++---------
 sysdeps/mach/xpg-strerror.c |   17 ++++-------------
 3 files changed, 14 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]