mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 14:24:24 +02:00
* IN case of IO error, MD5File will return an empty digest. Fixes issue #41194
This commit is contained in:
parent
bf510fbd62
commit
2256593e92
@ -630,8 +630,12 @@ begin
|
||||
Reset(F, 1);
|
||||
{$pop}
|
||||
|
||||
if IOResult = 0 then
|
||||
if IOResult <> 0 then
|
||||
begin
|
||||
Result:=Default(TMDDigest);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
GetMem(Buf, BufSize);
|
||||
repeat
|
||||
BlockRead(F, Buf^, Bufsize, Count);
|
||||
@ -640,7 +644,6 @@ begin
|
||||
until Count < BufSize;
|
||||
FreeMem(Buf, BufSize);
|
||||
Close(F);
|
||||
end;
|
||||
|
||||
MDFinal(Context, Result);
|
||||
FileMode := ofm;
|
||||
@ -663,8 +666,11 @@ begin
|
||||
Reset(F, 1);
|
||||
{$pop}
|
||||
|
||||
if IOResult = 0 then
|
||||
if IOResult <> 0 then
|
||||
begin
|
||||
Result:=Default(TMDDigest);
|
||||
Exit;
|
||||
end;
|
||||
GetMem(Buf, BufSize);
|
||||
repeat
|
||||
BlockRead(F, Buf^, Bufsize, Count);
|
||||
@ -673,7 +679,6 @@ begin
|
||||
until Count < BufSize;
|
||||
FreeMem(Buf, BufSize);
|
||||
Close(F);
|
||||
end;
|
||||
|
||||
MDFinal(Context, Result);
|
||||
FileMode := ofm;
|
||||
|
Loading…
Reference in New Issue
Block a user