summary refs log tree commit diff
path: root/string/strcoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/strcoll.c')
-rw-r--r--string/strcoll.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/string/strcoll.c b/string/strcoll.c
index cc39820fcf..8457ef8df1 100644
--- a/string/strcoll.c
+++ b/string/strcoll.c
@@ -82,6 +82,12 @@ STRCOLL (s1, s2, l)
   if (collate_nrules == 0)
     return STRCMP (s1, s2);
 
+  /* Handle empty strings as a special case.  */
+  if (*s1 == '\0')
+    return *s2 == '\0' ? 0 : -1;
+  else if (*s2 == '\0')
+    return 1;
+
   /* Get full information about the strings.  This means we get
      information for all passes in a special data structure.  */
   get_string (s1, s1forw, s1backw);