aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/dets_v9.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2010-11-04 15:20:23 +0100
committerHans Bolinder <[email protected]>2010-11-04 15:20:23 +0100
commit1d3edd9e902269d956d38e883127c9c7527f419d (patch)
tree25dd2d511f28174e89006024a5babda9bcdce1b0 /lib/stdlib/src/dets_v9.erl
parentf8ac585a7ba8b2d35bc24c6d7c2fa5d5df1e2f6e (diff)
downloadotp-1d3edd9e902269d956d38e883127c9c7527f419d.tar.gz
otp-1d3edd9e902269d956d38e883127c9c7527f419d.tar.bz2
otp-1d3edd9e902269d956d38e883127c9c7527f419d.zip
Fix badly formed Dets file after initialization
If a Dets table with fewer slots than keys was opened and then closed after just a lookup, the contents were no longer well-formed. This bug has been fixed. (Thanks to Matthew Evans.)
Diffstat (limited to 'lib/stdlib/src/dets_v9.erl')
-rw-r--r--lib/stdlib/src/dets_v9.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/stdlib/src/dets_v9.erl b/lib/stdlib/src/dets_v9.erl
index 53238e962f..132af01f79 100644
--- a/lib/stdlib/src/dets_v9.erl
+++ b/lib/stdlib/src/dets_v9.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1908,6 +1908,9 @@ write_cache(Head) ->
end.
%% -> {NewHead, ok} | {NewHead, Error}
+may_grow(Head, 0, once) ->
+ %% Do not re-hash if there is a chance that the file is not dirty.
+ {Head, ok};
may_grow(Head, _N, _How) when Head#head.fixed =/= false ->
{Head, ok};
may_grow(#head{access = read}=Head, _N, _How) ->