aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-23 20:34:21 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-23 20:34:21 +0000
commit8073a49484461fbf71cacb154cc2aa2cdac0cca2 (patch)
tree3d74aea1c5ac88d40598aa1b3180f43bfb551c27 /misc
parent0699a0ca6aaf93443fc807ff77c74889fcef8a58 (diff)
downloadglibc-8073a49484461fbf71cacb154cc2aa2cdac0cca2.zip
glibc-8073a49484461fbf71cacb154cc2aa2cdac0cca2.tar.gz
glibc-8073a49484461fbf71cacb154cc2aa2cdac0cca2.tar.bz2
(hcreate_r): We need at least three elements in the hash table.
Diffstat (limited to 'misc')
-rw-r--r--misc/hsearch_r.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
index c855a41..6e32afc 100644
--- a/misc/hsearch_r.c
+++ b/misc/hsearch_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008
+/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008,2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
@@ -79,6 +79,10 @@ hcreate_r (nel, htab)
if (htab->table != NULL)
return 0;
+ /* We need a size of at least 3. Otherwise the hash functions we
+ use will not work. */
+ if (nel < 3)
+ nel = 3;
/* Change nel to the first prime number not smaller as nel. */
nel |= 1; /* make odd */
while (!isprime (nel))