diff options
author | Jeremy Allison <jra@samba.org> | 2000-06-09 18:54:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-06-09 18:54:41 +0000 |
commit | eab8f3c9405d108e4bc05f02a4a595bbb13ba403 (patch) | |
tree | d5dbfefaa4df19f85e4d17126c50046e5805fd10 /source3/lib | |
parent | 03e0164270ffd7ceeb8df6f3cc3917c111dc05f8 (diff) | |
download | samba-eab8f3c9405d108e4bc05f02a4a595bbb13ba403.tar.gz samba-eab8f3c9405d108e4bc05f02a4a595bbb13ba403.tar.bz2 samba-eab8f3c9405d108e4bc05f02a4a595bbb13ba403.zip |
Fix from Elrond for hash table corruption. Should fix stat cache bug (I
sincerely hope :-). Thanks elrond !
Jeremy.
(This used to be commit 0d59e8c6bf49e06f11b386f9d805474771365f52)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/hash.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/lib/hash.c b/source3/lib/hash.c index ccaf65b55a..cfb34a5488 100644 --- a/source3/lib/hash.c +++ b/source3/lib/hash.c @@ -61,7 +61,7 @@ BOOL hash_table_init(hash_table *table, int num_buckets, compare_function compar table->size = 2; table->comp_func = compare_func; while (table->size < num_buckets) - table->size <<= 1; + table->size <<= 1; for (i = 0; i < NUM_PRIMES; i++) { if (primes[i] > table->size) { table->size = primes[i]; @@ -301,7 +301,7 @@ static BOOL enlarge_hash_table(hash_table *table) ************************************************************************* */ -void hash_clear(hash_table *table) +BOOL hash_clear(hash_table *table) { int i; ubi_dlList *bucket = table->buckets; @@ -315,6 +315,14 @@ void hash_clear(hash_table *table) free((char *)hash_elem); } } + table->size = 0; if(table->buckets) free((char *) table->buckets); + table->buckets = NULL; + + /* Reinitialize the hash table. */ + if(!hash_table_init(table, 0, table->comp_func)) + return False; + + return True; } |