[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.28 and 1.29

version 1.28, 2000/04/16 04:47:43 version 1.29, 2000/05/01 07:05:08
Line 543 
Line 543 
                         (void) sprintf(buf, "T%lu 0 %lu 0\n",                          (void) sprintf(buf, "T%lu 0 %lu 0\n",
                                        (unsigned long) stb.st_mtime,                                         (unsigned long) stb.st_mtime,
                                        (unsigned long) stb.st_atime);                                         (unsigned long) stb.st_atime);
                         (void) write(remout, buf, strlen(buf));                          (void) atomicio(write, remout, buf, strlen(buf));
                         if (response() < 0)                          if (response() < 0)
                                 goto next;                                  goto next;
                 }                  }
Line 556 
Line 556 
                         fprintf(stderr, "Sending file modes: %s", buf);                          fprintf(stderr, "Sending file modes: %s", buf);
                         fflush(stderr);                          fflush(stderr);
                 }                  }
                 (void) write(remout, buf, strlen(buf));                  (void) atomicio(write, remout, buf, strlen(buf));
                 if (response() < 0)                  if (response() < 0)
                         goto next;                          goto next;
                 if ((bp = allocbuf(&buffer, fd, 2048)) == NULL) {                  if ((bp = allocbuf(&buffer, fd, 2048)) == NULL) {
Line 578 
Line 578 
                                         haderr = result >= 0 ? EIO : errno;                                          haderr = result >= 0 ? EIO : errno;
                         }                          }
                         if (haderr)                          if (haderr)
                                 (void) write(remout, bp->buf, amt);                                  (void) atomicio(write, remout, bp->buf, amt);
                         else {                          else {
                                 result = write(remout, bp->buf, amt);                                  result = atomicio(write, remout, bp->buf, amt);
                                 if (result != amt)                                  if (result != amt)
                                         haderr = result >= 0 ? EIO : errno;                                          haderr = result >= 0 ? EIO : errno;
                                 statbytes += result;                                  statbytes += result;
Line 592 
Line 592 
                 if (close(fd) < 0 && !haderr)                  if (close(fd) < 0 && !haderr)
                         haderr = errno;                          haderr = errno;
                 if (!haderr)                  if (!haderr)
                         (void) write(remout, "", 1);                          (void) atomicio(write, remout, "", 1);
                 else                  else
                         run_err("%s: %s", name, strerror(haderr));                          run_err("%s: %s", name, strerror(haderr));
                 (void) response();                  (void) response();
Line 621 
Line 621 
                 (void) sprintf(path, "T%lu 0 %lu 0\n",                  (void) sprintf(path, "T%lu 0 %lu 0\n",
                                (unsigned long) statp->st_mtime,                                 (unsigned long) statp->st_mtime,
                                (unsigned long) statp->st_atime);                                 (unsigned long) statp->st_atime);
                 (void) write(remout, path, strlen(path));                  (void) atomicio(write, remout, path, strlen(path));
                 if (response() < 0) {                  if (response() < 0) {
                         closedir(dirp);                          closedir(dirp);
                         return;                          return;
Line 632 
Line 632 
                        0, last);                         0, last);
         if (verbose_mode)          if (verbose_mode)
                 fprintf(stderr, "Entering directory: %s", path);                  fprintf(stderr, "Entering directory: %s", path);
         (void) write(remout, path, strlen(path));          (void) atomicio(write, remout, path, strlen(path));
         if (response() < 0) {          if (response() < 0) {
                 closedir(dirp);                  closedir(dirp);
                 return;                  return;
Line 651 
Line 651 
                 source(1, vect);                  source(1, vect);
         }          }
         (void) closedir(dirp);          (void) closedir(dirp);
         (void) write(remout, "E\n", 2);          (void) atomicio(write, remout, "E\n", 2);
         (void) response();          (void) response();
 }  }
   
Line 687 
Line 687 
         if (targetshouldbedirectory)          if (targetshouldbedirectory)
                 verifydir(targ);                  verifydir(targ);
   
         (void) write(remout, "", 1);          (void) atomicio(write, remout, "", 1);
         if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode))          if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode))
                 targisdir = 1;                  targisdir = 1;
         for (first = 1;; first = 0) {          for (first = 1;; first = 0) {
Line 705 
Line 705 
   
                 if (buf[0] == '\01' || buf[0] == '\02') {                  if (buf[0] == '\01' || buf[0] == '\02') {
                         if (iamremote == 0)                          if (iamremote == 0)
                                 (void) write(STDERR_FILENO,                                  (void) atomicio(write, STDERR_FILENO,
                                              buf + 1, strlen(buf + 1));                                               buf + 1, strlen(buf + 1));
                         if (buf[0] == '\02')                          if (buf[0] == '\02')
                                 exit(1);                                  exit(1);
Line 713 
Line 713 
                         continue;                          continue;
                 }                  }
                 if (buf[0] == 'E') {                  if (buf[0] == 'E') {
                         (void) write(remout, "", 1);                          (void) atomicio(write, remout, "", 1);
                         return;                          return;
                 }                  }
                 if (ch == '\n')                  if (ch == '\n')
Line 737 
Line 737 
                         getnum(dummy_usec);                          getnum(dummy_usec);
                         if (*cp++ != '\0')                          if (*cp++ != '\0')
                                 SCREWUP("atime.usec not delimited");                                  SCREWUP("atime.usec not delimited");
                         (void) write(remout, "", 1);                          (void) atomicio(write, remout, "", 1);
                         continue;                          continue;
                 }                  }
                 if (*cp != 'C' && *cp != 'D') {                  if (*cp != 'C' && *cp != 'D') {
Line 816 
Line 816 
 bad:                    run_err("%s: %s", np, strerror(errno));  bad:                    run_err("%s: %s", np, strerror(errno));
                         continue;                          continue;
                 }                  }
                 (void) write(remout, "", 1);                  (void) atomicio(write, remout, "", 1);
                 if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) {                  if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) {
                         (void) close(ofd);                          (void) close(ofd);
                         continue;                          continue;
Line 897 
Line 897 
                         run_err("%s: %s", np, strerror(wrerrno));                          run_err("%s: %s", np, strerror(wrerrno));
                         break;                          break;
                 case NO:                  case NO:
                         (void) write(remout, "", 1);                          (void) atomicio(write, remout, "", 1);
                         break;                          break;
                 case DISPLAYED:                  case DISPLAYED:
                         break;                          break;
Line 932 
Line 932 
                 } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');                  } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');
   
                 if (!iamremote)                  if (!iamremote)
                         (void) write(STDERR_FILENO, rbuf, cp - rbuf);                          (void) atomicio(write, STDERR_FILENO, rbuf, cp - rbuf);
                 ++errs;                  ++errs;
                 if (resp == 1)                  if (resp == 1)
                         return (-1);                          return (-1);
Line 1234 
Line 1234 
                 alarmtimer(1);                  alarmtimer(1);
         } else if (flag == 1) {          } else if (flag == 1) {
                 alarmtimer(0);                  alarmtimer(0);
                 write(fileno(stdout), "\n", 1);                  atomicio(write, fileno(stdout), "\n", 1);
                 statbytes = 0;                  statbytes = 0;
         }          }
 }  }

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