* if no locking is specified, also request an exclusive lock for solaris

in case the file is opened as read/write (instead of only if opened as
    write-only)

git-svn-id: trunk@12685 -
This commit is contained in:
Jonas Maebe 2009-02-04 11:41:18 +00:00
parent 78f6e5ff6e
commit 6f12cb03db

View File

@ -188,15 +188,19 @@ begin
{$ifdef solaris}
{ Solaris' flock is based on top of fcntl, which does not allow
exclusive locks for files only opened for reading nor shared
locks for files opened only for writing
locks for files opened only for writing.
If no locking is specified, we normally need an exclusive lock.
So create an exclusive lock for fmOpenWrite and fmOpenReadWrite,
but only a shared lock for fmOpenRead (since an exclusive lock
is not possible in that case)
}
if ((mode and (fmShareCompat or fmShareExclusive or fmShareDenyWrite or fmShareDenyRead or fmShareDenyNone)) = 0) then
begin
mode := mode and not(fmShareCompat);
if ((mode and (fmOpenRead or fmOpenWrite or fmOpenReadWrite)) = fmOpenWrite) then
mode := mode or fmShareExclusive
if ((mode and (fmOpenRead or fmOpenWrite or fmOpenReadWrite)) = fmOpenRead) then
mode := mode or fmShareDenyWrite
else
mode := mode or fmShareDenyWrite;
mode := mode or fmShareExclusive;
end;
{$endif solaris}
case (mode and (fmShareCompat or fmShareExclusive or fmShareDenyWrite or fmShareDenyRead or fmShareDenyNone)) of