Browse Source

* fix for repeating 'x' bug

marco 21 years ago
parent
commit
ae1f7f63b6
1 changed files with 8 additions and 4 deletions
  1. 8 4
      rtl/bsd/osmain.inc

+ 8 - 4
rtl/bsd/osmain.inc

@@ -209,7 +209,7 @@ Function Do_Write(Handle,Addr,Len:Longint):longint;
 Begin
 Begin
   repeat
   repeat
     Do_Write:=Fpwrite(Handle,pchar(addr),len);
     Do_Write:=Fpwrite(Handle,pchar(addr),len);
-  until (ErrNo<>ESysEINTR) and (Errno<>ESysEAgain);
+  until (do_write<>-1) or ((ErrNo<>ESysEINTR) and (Errno<>ESysEAgain));
   If Do_Write<0 Then
   If Do_Write<0 Then
    Begin
    Begin
     Errno2InOutRes;
     Errno2InOutRes;
@@ -224,7 +224,7 @@ Function Do_Read(Handle,Addr,Len:Longint):Longint;
 Begin
 Begin
   repeat
   repeat
     Do_Read:=Fpread(Handle,pchar(addr),len);
     Do_Read:=Fpread(Handle,pchar(addr),len);
-  until (ErrNo<>ESysEINTR) and (ErrNo<>ESysEAgain);
+  until (do_read<>-1) or ((ErrNo<>ESysEINTR) and (ErrNo<>ESysEAgain));
   If Do_Read<0 Then
   If Do_Read<0 Then
    Begin
    Begin
     Errno2InOutRes;
     Errno2InOutRes;
@@ -341,7 +341,8 @@ Begin
    end;
    end;
 { real open call }
 { real open call }
   FileRec(f).Handle:=Fpopen(p,oflags,MODE_OPEN);
   FileRec(f).Handle:=Fpopen(p,oflags,MODE_OPEN);
-  if (ErrNo=ESysEROFS) and ((OFlags and O_RDWR)<>0) then
+  if (FileRec(f).Handle<0) and
+    (ErrNo=ESysEROFS) and ((OFlags and O_RDWR)<>0) then
    begin
    begin
      Oflags:=Oflags and not(O_RDWR);
      Oflags:=Oflags and not(O_RDWR);
      FileRec(f).Handle:=Fpopen(p,oflags,MODE_OPEN);
      FileRec(f).Handle:=Fpopen(p,oflags,MODE_OPEN);
@@ -670,7 +671,10 @@ End.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.6  2003-11-18 10:12:25  marco
+   Revision 1.7  2003-12-14 14:47:02  marco
+    * fix for repeating 'x' bug
+
+   Revision 1.6  2003/11/18 10:12:25  marco
     * Small fixes for EAGAIN. bunxfunc only has comments added.
     * Small fixes for EAGAIN. bunxfunc only has comments added.
 
 
    Revision 1.5  2003/10/27 17:12:45  marco
    Revision 1.5  2003/10/27 17:12:45  marco