changeset 7149:bf3b976f47a7

(memcoll): Set errno = 0 in the shortcut case, too.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 16 Aug 2006 17:22:49 +0000
parents 06ddea502cf5
children 6817055f52b7
files lib/ChangeLog lib/memcoll.c
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* memcoll.c (memcoll): Set errno = 0 in the shortcut case, too.
+	Problem and fix reported by Pádraig Brady in
+	<http://lists.gnu.org/archive/html/bug-coreutils/2006-08/msg00099.html>.
+
 2006-08-15  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* memcoll.c (memcoll): Optimize for the common case where the
--- a/lib/memcoll.c
+++ b/lib/memcoll.c
@@ -43,7 +43,10 @@
      the buffers using strcoll on each substring.  */
 
   if (s1len == s2len && memcmp (s1, s2, s1len) == 0)
-    diff = 0;
+    {
+      errno = 0;
+      diff = 0;
+    }
   else
     {
       char n1 = s1[s1len];