Fix two bugs found by PULSE in corfurl_flu.erl, yay!
This commit is contained in:
parent
86d4583aef
commit
db6fa3d895
1 changed files with 5 additions and 3 deletions
|
@ -294,10 +294,12 @@ check_write(LogicalPN, PageBin,
|
||||||
|
|
||||||
check_is_written(Offset, _PhysicalPN, #state{mem_fh=FH}) ->
|
check_is_written(Offset, _PhysicalPN, #state{mem_fh=FH}) ->
|
||||||
case file:pread(FH, Offset, 1) of
|
case file:pread(FH, Offset, 1) of
|
||||||
{ok, <<1:8>>} ->
|
|
||||||
true;
|
|
||||||
{ok, <<0:8>>} ->
|
{ok, <<0:8>>} ->
|
||||||
false;
|
false;
|
||||||
|
{ok, <<1:8>>} -> % written
|
||||||
|
true;
|
||||||
|
{ok, <<2:8>>} -> % trimmed
|
||||||
|
true;
|
||||||
eof ->
|
eof ->
|
||||||
%% We assume that Offset has been bounds-checked
|
%% We assume that Offset has been bounds-checked
|
||||||
false
|
false
|
||||||
|
@ -318,7 +320,7 @@ read_page(LogicalPN, #state{max_mem=MaxMem, mem_fh=FH,
|
||||||
io:format("BUMMER: ~s line ~w: incomplete write at ~p\n",
|
io:format("BUMMER: ~s line ~w: incomplete write at ~p\n",
|
||||||
[?MODULE, ?LINE, LogicalPN]),
|
[?MODULE, ?LINE, LogicalPN]),
|
||||||
error_unwritten;
|
error_unwritten;
|
||||||
{ok, <<2:8>>} ->
|
{ok, <<2:8, _/binary>>} ->
|
||||||
error_trimmed;
|
error_trimmed;
|
||||||
{ok, _} ->
|
{ok, _} ->
|
||||||
error_unwritten;
|
error_unwritten;
|
||||||
|
|
Loading…
Reference in a new issue