Browse Source

* patch by Serg Bormant: fix fmShareCompat handling for win32/win64/nativent, resolves #23725

git-svn-id: trunk@23542 -
florian 12 years ago
parent
commit
9315eba917
4 changed files with 16 additions and 2 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      rtl/nativent/sysfile.inc
  3. 1 1
      rtl/win/sysfile.inc
  4. 13 0
      tests/webtbs/tw23725.pp

+ 1 - 0
.gitattributes

@@ -13156,6 +13156,7 @@ tests/webtbs/tw23503.pp svneol=native#text/pascal
 tests/webtbs/tw2351.pp svneol=native#text/plain
 tests/webtbs/tw23568.pp -text svneol=native#text/plain
 tests/webtbs/tw2363.pp svneol=native#text/plain
+tests/webtbs/tw23725.pp svneol=native#text/pascal
 tests/webtbs/tw23744.pp svneol=native#text/plain
 tests/webtbs/tw2377.pp svneol=native#text/plain
 tests/webtbs/tw2378.pp svneol=native#text/plain

+ 1 - 1
rtl/nativent/sysfile.inc

@@ -329,7 +329,7 @@ begin
   if ((filemode and fmshareExclusive) = fmshareExclusive) then
     { no sharing }
   else
-    if (filemode = fmShareCompat) or ((filemode and fmshareDenyWrite) = fmshareDenyWrite) then
+    if ((filemode and $F0) = fmShareCompat) or ((filemode and fmshareDenyWrite) = fmshareDenyWrite) then
       shflags := FILE_SHARE_READ
   else
     if ((filemode and fmshareDenyRead) = fmshareDenyRead) then

+ 1 - 1
rtl/win/sysfile.inc

@@ -230,7 +230,7 @@ begin
   if ((filemode and fmshareExclusive) = fmshareExclusive) then
     { no sharing }
   else
-    if (filemode = fmShareCompat) or ((filemode and fmshareDenyWrite) = fmshareDenyWrite) then
+    if ((filemode and $f0) = fmShareCompat) or ((filemode and fmshareDenyWrite) = fmshareDenyWrite) then
       shflags := file_Share_Read
   else
     if ((filemode and fmshareDenyRead) = fmshareDenyRead) then

+ 13 - 0
tests/webtbs/tw23725.pp

@@ -0,0 +1,13 @@
+var
+  t,t1, t2: text;
+  s: string;
+begin
+  assign(t,'tw23725.txt');
+  rewrite(t);
+  writeln(t);
+  close(t);
+  assign(t1, 'tw23725.txt'); assign(t2, 'tw23725.txt');
+  write('Opening 1... '); reset(t1); writeln('done.');
+  write('Opening 2... '); reset(t2); writeln('done.');
+  close(t2); close(t1);
+end.