summary refs log tree commit diff
path: root/misc/hsearch_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/hsearch_r.c')
-rw-r--r--misc/hsearch_r.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
index d9255e1c6b..fbf55eebf6 100644
--- a/misc/hsearch_r.c
+++ b/misc/hsearch_r.c
@@ -187,6 +187,10 @@ hsearch_r (item, action, retval, htab)
 	  else
 	    idx -= hval2;
 
+	  /* If we visited all entries leave the loop unsuccessfully.  */
+	  if (idx == hval)
+	    break;
+
             /* If entry is found use it. */
           if (htab->table[idx].used == hval
 	      && strcmp (item.key, htab->table[idx].entry.key) == 0)