This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / sim / common / syscall.c
index a1031d936edaccdc7f48c51778100fac324108c0..e0a3b880b84c26a061b8e3a2400ce6c5f78cda49 100644 (file)
@@ -1,5 +1,5 @@
 /* Remote target system call support.
-   Copyright 1997 Free Software Foundation, Inc.
+   Copyright 1997, 1998 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions.
 
    This file is part of GDB.
@@ -279,6 +279,8 @@ cb_syscall (cb, sc)
                                           ? count : FILE_XFR_SIZE));
            if (result == -1)
              goto ErrorFinish;
+           if (result == 0)    /* EOF */
+             break;
            bytes_written = (*sc->write_mem) (cb, sc, addr, buf, result);
            if (bytes_written != result)
              {
@@ -289,6 +291,9 @@ cb_syscall (cb, sc)
            bytes_read += result;
            count -= result;
            addr += result;
+           /* If this is a short read, don't go back for more */
+           if (result != FILE_XFR_SIZE)
+             break;
          }
        result = bytes_read;
       }
@@ -318,9 +323,15 @@ cb_syscall (cb, sc)
                goto FinishSyscall;
              }
            if (fd == 1)
-             result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
-           if (fd == 2)
-             result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
+             {
+               result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
+               (*cb->flush_stdout) (cb);
+             }
+           else if (fd == 2)
+             {
+               result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
+               (*cb->flush_stderr) (cb);
+             }
            else
              result = (int) (*cb->write) (cb, fd, buf, bytes_read);
            if (result == -1)
This page took 0.02362 seconds and 4 git commands to generate.