mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 22:48:57 +02:00
* fmShareDenyNone should also take a shared lock (+ test)
git-svn-id: trunk@30877 -
This commit is contained in:
parent
be6dc49aa5
commit
9b987fde93
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
23
tests/webtbs/tw27998a.pp
Normal 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.
|
||||
|
Loading…
Reference in New Issue
Block a user