* fmShareDenyNone should also take a shared lock (+ test)

git-svn-id: trunk@30877 -
This commit is contained in:
Jonas Maebe 2015-05-17 11:08:08 +00:00
parent be6dc49aa5
commit 9b987fde93
3 changed files with 26 additions and 3 deletions

1
.gitattributes vendored
View File

@ -14487,6 +14487,7 @@ tests/webtbs/tw27880.pp svneol=native#text/plain
tests/webtbs/tw2789.pp svneol=native#text/plain
tests/webtbs/tw2794.pp svneol=native#text/plain
tests/webtbs/tw27998.pp svneol=native#text/plain
tests/webtbs/tw27998a.pp svneol=native#text/plain
tests/webtbs/tw28007.pp svneol=native#text/pascal
tests/webtbs/tw2803.pp svneol=native#text/plain
tests/webtbs/tw2806.pp svneol=native#text/plain

View File

@ -396,10 +396,9 @@ begin
fmShareCompat,
fmShareExclusive:
lockop:=LOCK_EX or LOCK_NB;
fmShareDenyWrite:
lockop:=LOCK_SH or LOCK_NB;
fmShareDenyWrite,
fmShareDenyNone:
exit;
lockop:=LOCK_SH or LOCK_NB;
else
begin
{ fmShareDenyRead does not exit under *nix, only shared access

23
tests/webtbs/tw27998a.pp Normal file
View File

@ -0,0 +1,23 @@
program a;
{$mode delphi}
uses
SysUtils, Classes;
const
LockFile = 'lock.txt';
var
H, H2 : TStream;
begin
try
H := TFileStream.Create(lockFile, fmCreate);
{ should raise exception because of exclusive lock above }
H2 := TFileStream.create(LockFile, fmOpenRead or fmShareDenyNone);
H2.free;
H.free;
DeleteFile(LockFile);
halt(1);
except
H.free;
DeleteFile(LockFile);
end
end.