mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 11:29:16 +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/tw2789.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2794.pp svneol=native#text/plain
|
tests/webtbs/tw2794.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw27998.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/tw28007.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2803.pp svneol=native#text/plain
|
tests/webtbs/tw2803.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2806.pp svneol=native#text/plain
|
tests/webtbs/tw2806.pp svneol=native#text/plain
|
||||||
|
@ -396,10 +396,9 @@ begin
|
|||||||
fmShareCompat,
|
fmShareCompat,
|
||||||
fmShareExclusive:
|
fmShareExclusive:
|
||||||
lockop:=LOCK_EX or LOCK_NB;
|
lockop:=LOCK_EX or LOCK_NB;
|
||||||
fmShareDenyWrite:
|
fmShareDenyWrite,
|
||||||
lockop:=LOCK_SH or LOCK_NB;
|
|
||||||
fmShareDenyNone:
|
fmShareDenyNone:
|
||||||
exit;
|
lockop:=LOCK_SH or LOCK_NB;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ fmShareDenyRead does not exit under *nix, only shared access
|
{ 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