[BACK]Return to scp.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/scp.c between version 1.29 and 1.30

version 1.29, 2000/05/01 07:05:08 version 1.30, 2000/05/02 18:21:48
Line 573 
Line 573 
                         if (i + amt > stb.st_size)                          if (i + amt > stb.st_size)
                                 amt = stb.st_size - i;                                  amt = stb.st_size - i;
                         if (!haderr) {                          if (!haderr) {
                                 result = read(fd, bp->buf, amt);                                  result = atomicio(read, fd, bp->buf, amt);
                                 if (result != amt)                                  if (result != amt)
                                         haderr = result >= 0 ? EIO : errno;                                          haderr = result >= 0 ? EIO : errno;
                         }                          }
Line 692 
Line 692 
                 targisdir = 1;                  targisdir = 1;
         for (first = 1;; first = 0) {          for (first = 1;; first = 0) {
                 cp = buf;                  cp = buf;
                 if (read(remin, cp, 1) <= 0)                  if (atomicio(read, remin, cp, 1) <= 0)
                         return;                          return;
                 if (*cp++ == '\n')                  if (*cp++ == '\n')
                         SCREWUP("unexpected <newline>");                          SCREWUP("unexpected <newline>");
                 do {                  do {
                         if (read(remin, &ch, sizeof(ch)) != sizeof(ch))                          if (atomicio(read, remin, &ch, sizeof(ch)) != sizeof(ch))
                                 SCREWUP("lost connection");                                  SCREWUP("lost connection");
                         *cp++ = ch;                          *cp++ = ch;
                 } while (cp < &buf[sizeof(buf) - 1] && ch != '\n');                  } while (cp < &buf[sizeof(buf) - 1] && ch != '\n');
Line 835 
Line 835 
                                 amt = size - i;                                  amt = size - i;
                         count += amt;                          count += amt;
                         do {                          do {
                                 j = read(remin, cp, amt);                                  j = atomicio(read, remin, cp, amt);
                                 if (j <= 0) {                                  if (j <= 0) {
                                         run_err("%s", j ? strerror(errno) :                                          run_err("%s", j ? strerror(errno) :
                                                 "dropped connection");                                                  "dropped connection");
Line 848 
Line 848 
                         if (count == bp->cnt) {                          if (count == bp->cnt) {
                                 /* Keep reading so we stay sync'd up. */                                  /* Keep reading so we stay sync'd up. */
                                 if (wrerr == NO) {                                  if (wrerr == NO) {
                                         j = write(ofd, bp->buf, count);                                          j = atomicio(write, ofd, bp->buf, count);
                                         if (j != count) {                                          if (j != count) {
                                                 wrerr = YES;                                                  wrerr = YES;
                                                 wrerrno = j >= 0 ? EIO : errno;                                                  wrerrno = j >= 0 ? EIO : errno;
Line 861 
Line 861 
                 if (showprogress)                  if (showprogress)
                         progressmeter(1);                          progressmeter(1);
                 if (count != 0 && wrerr == NO &&                  if (count != 0 && wrerr == NO &&
                     (j = write(ofd, bp->buf, count)) != count) {                      (j = atomicio(write, ofd, bp->buf, count)) != count) {
                         wrerr = YES;                          wrerr = YES;
                         wrerrno = j >= 0 ? EIO : errno;                          wrerrno = j >= 0 ? EIO : errno;
                 }                  }
Line 913 
Line 913 
 {  {
         char ch, *cp, resp, rbuf[2048];          char ch, *cp, resp, rbuf[2048];
   
         if (read(remin, &resp, sizeof(resp)) != sizeof(resp))          if (atomicio(read, remin, &resp, sizeof(resp)) != sizeof(resp))
                 lostconn(0);                  lostconn(0);
   
         cp = rbuf;          cp = rbuf;
Line 926 
Line 926 
         case 1:         /* error, followed by error msg */          case 1:         /* error, followed by error msg */
         case 2:         /* fatal error, "" */          case 2:         /* fatal error, "" */
                 do {                  do {
                         if (read(remin, &ch, sizeof(ch)) != sizeof(ch))                          if (atomicio(read, remin, &ch, sizeof(ch)) != sizeof(ch))
                                 lostconn(0);                                  lostconn(0);
                         *cp++ = ch;                          *cp++ = ch;
                 } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');                  } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30