[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.117.2.2 and 1.118

version 1.117.2.2, 2005/09/02 03:45:00 version 1.118, 2004/09/15 18:46:04
Line 108 
Line 108 
 static void  static void
 killchild(int signo)  killchild(int signo)
 {  {
         if (do_cmd_pid > 1) {          if (do_cmd_pid > 1)
                 kill(do_cmd_pid, signo ? signo : SIGTERM);                  kill(do_cmd_pid, signo);
                 waitpid(do_cmd_pid, NULL, 0);  
         }  
   
         if (signo)          _exit(1);
                 _exit(1);  
         exit(1);  
 }  }
   
 /*  /*
Line 186 
Line 182 
 }  }
   
 typedef struct {  typedef struct {
         size_t cnt;          int cnt;
         char *buf;          char *buf;
 } BUF;  } BUF;
   
Line 358 
Line 354 
 toremote(char *targ, int argc, char **argv)  toremote(char *targ, int argc, char **argv)
 {  {
         int i, len;          int i, len;
         char *bp, *host, *src, *suser, *thost, *tuser, *arg;          char *bp, *host, *src, *suser, *thost, *tuser;
   
         *targ++ = 0;          *targ++ = 0;
         if (*targ == 0)          if (*targ == 0)
                 targ = ".";                  targ = ".";
   
         arg = xstrdup(argv[argc - 1]);          if ((thost = strrchr(argv[argc - 1], '@'))) {
         if ((thost = strrchr(arg, '@'))) {  
                 /* user@host */                  /* user@host */
                 *thost++ = 0;                  *thost++ = 0;
                 tuser = arg;                  tuser = argv[argc - 1];
                 if (*tuser == '\0')                  if (*tuser == '\0')
                         tuser = NULL;                          tuser = NULL;
         } else {          } else {
                 thost = arg;                  thost = argv[argc - 1];
                 tuser = NULL;                  tuser = NULL;
         }          }
   
Line 499 
Line 494 
         struct stat stb;          struct stat stb;
         static BUF buffer;          static BUF buffer;
         BUF *bp;          BUF *bp;
         off_t i, amt, statbytes;          off_t i, amt, result, statbytes;
         size_t result;          int fd, haderr, indx;
         int fd = -1, haderr, indx;  
         char *last, *name, buf[2048];          char *last, *name, buf[2048];
         int len;          int len;
   
Line 576 
Line 570 
                         if (!haderr) {                          if (!haderr) {
                                 result = atomicio(read, fd, bp->buf, amt);                                  result = atomicio(read, fd, bp->buf, amt);
                                 if (result != amt)                                  if (result != amt)
                                         haderr = errno;                                          haderr = result >= 0 ? EIO : errno;
                         }                          }
                         if (haderr)                          if (haderr)
                                 (void) atomicio(vwrite, remout, bp->buf, amt);                                  (void) atomicio(vwrite, remout, bp->buf, amt);
                         else {                          else {
                                 result = atomicio(vwrite, remout, bp->buf, amt);                                  result = atomicio(vwrite, remout, bp->buf, amt);
                                 if (result != amt)                                  if (result != amt)
                                         haderr = errno;                                          haderr = result >= 0 ? EIO : errno;
                                 statbytes += result;                                  statbytes += result;
                         }                          }
                         if (limit_rate)                          if (limit_rate)
Line 718 
Line 712 
                 YES, NO, DISPLAYED                  YES, NO, DISPLAYED
         } wrerr;          } wrerr;
         BUF *bp;          BUF *bp;
         off_t i;          off_t i, j;
         size_t j, count;          int amt, count, exists, first, mask, mode, ofd, omode;
         int amt, exists, first, mask, mode, ofd, omode;  
         off_t size, statbytes;          off_t size, statbytes;
         int setimes, targisdir, wrerrno = 0;          int setimes, targisdir, wrerrno = 0;
         char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];          char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
Line 747 
Line 740 
                 targisdir = 1;                  targisdir = 1;
         for (first = 1;; first = 0) {          for (first = 1;; first = 0) {
                 cp = buf;                  cp = buf;
                 if (atomicio(read, remin, cp, 1) != 1)                  if (atomicio(read, remin, cp, 1) <= 0)
                         return;                          return;
                 if (*cp++ == '\n')                  if (*cp++ == '\n')
                         SCREWUP("unexpected <newline>");                          SCREWUP("unexpected <newline>");
Line 828 
Line 821 
                 }                  }
                 if (targisdir) {                  if (targisdir) {
                         static char *namebuf;                          static char *namebuf;
                         static size_t cursize;                          static int cursize;
                         size_t need;                          size_t need;
   
                         need = strlen(targ) + strlen(cp) + 250;                          need = strlen(targ) + strlen(cp) + 250;
Line 901 
Line 894 
                         count += amt;                          count += amt;
                         do {                          do {
                                 j = atomicio(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");
                                         exit(1);                                          exit(1);
Line 917 
Line 910 
                         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) {
                                         if (atomicio(vwrite, ofd, bp->buf,                                          j = atomicio(vwrite, ofd, bp->buf, count);
                                             count) != count) {                                          if (j != count) {
                                                 wrerr = YES;                                                  wrerr = YES;
                                                 wrerrno = errno;                                                  wrerrno = j >= 0 ? EIO : errno;
                                         }                                          }
                                 }                                  }
                                 count = 0;                                  count = 0;
Line 930 
Line 923 
                 if (showprogress)                  if (showprogress)
                         stop_progress_meter();                          stop_progress_meter();
                 if (count != 0 && wrerr == NO &&                  if (count != 0 && wrerr == NO &&
                     atomicio(vwrite, ofd, bp->buf, count) != count) {                      (j = atomicio(vwrite, ofd, bp->buf, count)) != count) {
                         wrerr = YES;                          wrerr = YES;
                         wrerrno = errno;                          wrerrno = j >= 0 ? EIO : errno;
                 }                  }
                 if (wrerr == NO && ftruncate(ofd, size) != 0) {                  if (wrerr == NO && ftruncate(ofd, size) != 0) {
                         run_err("%s: truncate: %s", np, strerror(errno));                          run_err("%s: truncate: %s", np, strerror(errno));
Line 1061 
Line 1054 
                 errno = ENOTDIR;                  errno = ENOTDIR;
         }          }
         run_err("%s: %s", cp, strerror(errno));          run_err("%s: %s", cp, strerror(errno));
         killchild(0);          exit(1);
 }  }
   
 int  int

Legend:
Removed from v.1.117.2.2  
changed lines
  Added in v.1.118