|
@@ -185,12 +185,26 @@ begin
|
|
|
{$ifndef beos}
|
|
|
if (Handle>=0) then
|
|
|
begin
|
|
|
- case (mode and (fmShareCompat or fmShareExclusive or fmShareDenyWrite or fmShareDenyRead)) of
|
|
|
+{$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
|
|
|
+ }
|
|
|
+ if ((mode and (fmShareCompat or fmShareExclusive or fmShareDenyWrite or fmShareDenyRead)) = 0) then
|
|
|
+ begin
|
|
|
+ mode := mode and not(fmShareCompat);
|
|
|
+ if ((mode and (fmOpenRead or fmOpenWrite or fmOpenReadWrite)) = fmOpenWrite) then
|
|
|
+ mode := mode or fmShareExclusive
|
|
|
+ else
|
|
|
+ mode := mode or fmShareDenyWrite;
|
|
|
+ end;
|
|
|
+{$endif solaris}
|
|
|
+ case (mode and (fmShareCompat or fmShareExclusive or fmShareDenyWrite or fmShareDenyRead or fmShareDenyNone)) of
|
|
|
+ fmShareCompat,
|
|
|
fmShareExclusive:
|
|
|
lockop:=LOCK_EX or LOCK_NB;
|
|
|
fmShareDenyWrite:
|
|
|
lockop:=LOCK_SH or LOCK_NB;
|
|
|
- fmShareCompat,
|
|
|
fmShareDenyNone:
|
|
|
exit;
|
|
|
else
|