Преглед изворни кода

--- Merging r29666 into '.':
U rtl/os2/dos.pas
--- Merging r29668 into '.':
U rtl/os2/sysutils.pp
--- Merging r29669 into '.':
U rtl/os2/sysfile.inc
--- Merging r29700 into '.':
U compiler/systems/t_os2.pas

# revisions: 29666,29668,29669,29700

git-svn-id: branches/fixes_3_0@29767 -

marco пре 10 година
родитељ
комит
8239cd17d3
4 измењених фајлова са 27 додато и 15 уклоњено
  1. 2 2
      compiler/systems/t_os2.pas
  2. 7 4
      rtl/os2/dos.pas
  3. 2 1
      rtl/os2/sysfile.inc
  4. 16 8
      rtl/os2/sysutils.pp

+ 2 - 2
compiler/systems/t_os2.pas

@@ -520,10 +520,10 @@ begin
          StackSizeKB := 64
         else if StackSizeKB > (512 shl 10) then
          StackSizeKB := 512 shl 10;
-        Replace(cmdstr,'$STACKKB',tostr((stacksize+1023) shr 10));
+        Replace(cmdstr,'$STACKKB',tostr(StackSizeKB));
         {When an EMX program runs in DOS, the heap and stack share the
          same memory pool. The heap grows upwards, the stack grows downwards.}
-        Replace(cmdstr,'$DOSHEAPKB',tostr((stacksize+1023) shr 10));
+        Replace(cmdstr,'$DOSHEAPKB',tostr(StackSizeKB));
         Replace(cmdstr,'$STRIP ', StripStr);
         Replace(cmdstr,'$MAP ', MapStr);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);

+ 7 - 4
rtl/os2/dos.pas

@@ -754,16 +754,19 @@ begin
   if RC = 0 then
    begin
     PathInfo.AttrFile := Attr;
-    RC := DosSetPathInfo (P, ilStandard, @PathInfo, SizeOf (PathInfo),
-                                                        doWriteThru);
+    RC := DosSetPathInfo (P, ilStandard, @PathInfo, SizeOf (PathInfo), 0);
     if RC <> 0 then
-     OSErrorWatch (RC);
+     begin
+      OSErrorWatch (RC);
+      if Attr and VolumeID = VolumeID then
+       RC := 5; (* Align the returned error value to TP/BP *)
+     end;
    end
   else
    begin
     OSErrorWatch (RC);
     if FileRec (F).Name [0] = #0 then
-     DosError := 3; (* Align the returned error value to TP/BP *)
+     RC := 3; (* Align the returned error value to TP/BP *)
    end;
   DosError := integer (RC);
 end;

+ 2 - 1
rtl/os2/sysfile.inc

@@ -322,7 +322,8 @@ begin
     // Move to end of file for Append command
     if ((Flags and $100) <> 0) then
     begin
-      do_seekend(FileRec(F).Handle);
+      if not (Do_IsDevice (FileRec (F).Handle)) then
+       Do_SeekEnd (FileRec (F).Handle);
       FileRec(F).Mode := fmOutput;
     end;
 

+ 16 - 8
rtl/os2/sysutils.pp

@@ -80,9 +80,9 @@ Var
   Rc, Action: cardinal;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-(* DenyNone if sharing not specified. *)
+(* DenyReadWrite if sharing not specified. *)
   if (Mode and 112 = 0) or (Mode and 112 > 64) then
-   Mode := Mode or 64;
+   Mode := Mode or doDenyRW;
   Rc:=Sys_DosOpenL(PChar (SystemFileName), Handle, Action, 0, 0, 1, Mode, nil);
   If Rc=0 then
     FileOpen:=Handle
@@ -135,9 +135,13 @@ Var
   RC: cardinal;
 begin
   RC := DosRead (Handle, Buffer, Count, T);
-  FileRead := longint (T);
-  if RC <> 0 then
-   OSErrorWatch (RC);
+  if RC = 0 then
+   FileRead := longint (T)
+  else
+   begin
+    FileRead := -1;
+    OSErrorWatch (RC);
+   end;
 end;
 
 function FileWrite (Handle: THandle; const Buffer; Count: longint): longint;
@@ -146,9 +150,13 @@ Var
   RC: cardinal;
 begin
   RC := DosWrite (Handle, Buffer, Count, T);
-  FileWrite := longint (T);
-  if RC <> 0 then
-   OSErrorWatch (RC);
+  if RC = 0 then
+   FileWrite := longint (T)
+  else
+   begin
+    FileWrite := -1;
+    OSErrorWatch (RC);
+   end;
 end;
 
 function FileSeek (Handle: THandle; FOffset, Origin: longint): longint;