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

Diff for /src/usr.bin/ftp/fetch.c between version 1.112 and 1.113

version 1.112, 2013/12/24 13:00:59 version 1.113, 2014/02/26 20:48:06
Line 199 
Line 199 
         SSL *ssl = NULL;          SSL *ssl = NULL;
         int status;          int status;
         int save_errno;          int save_errno;
           const size_t buflen = 128 * 1024;
   
         direction = "received";          direction = "received";
   
Line 418 
Line 419 
                 hashbytes = mark;                  hashbytes = mark;
                 progressmeter(-1, path);                  progressmeter(-1, path);
   
                 if ((buf = malloc(4096)) == NULL)                  if ((buf = malloc(buflen)) == NULL)
                         errx(1, "Can't allocate memory for transfer buffer");                          errx(1, "Can't allocate memory for transfer buffer");
   
                 /* Finally, suck down the file. */                  /* Finally, suck down the file. */
                 i = 0;                  i = 0;
                 oldinti = signal(SIGINFO, psummary);                  oldinti = signal(SIGINFO, psummary);
                 while ((len = read(s, buf, 4096)) > 0) {                  while ((len = read(s, buf, buflen)) > 0) {
                         bytes += len;                          bytes += len;
                         for (cp = buf; len > 0; len -= i, cp += i) {                          for (cp = buf; len > 0; len -= i, cp += i) {
                                 if ((i = write(out, cp, len)) == -1) {                                  if ((i = write(out, cp, len)) == -1) {
Line 935 
Line 936 
         free(buf);          free(buf);
   
         /* Finally, suck down the file. */          /* Finally, suck down the file. */
         if ((buf = malloc(4096)) == NULL)          if ((buf = malloc(buflen)) == NULL)
                 errx(1, "Can't allocate memory for transfer buffer");                  errx(1, "Can't allocate memory for transfer buffer");
         i = 0;          i = 0;
         len = 1;          len = 1;
         oldinti = signal(SIGINFO, psummary);          oldinti = signal(SIGINFO, psummary);
         while (len > 0) {          while (len > 0) {
                 len = ftp_read(fin, ssl, buf, 4096);                  len = ftp_read(fin, ssl, buf, buflen);
                 bytes += len;                  bytes += len;
                 for (cp = buf, wlen = len; wlen > 0; wlen -= i, cp += i) {                  for (cp = buf, wlen = len; wlen > 0; wlen -= i, cp += i) {
                         if ((i = write(out, cp, wlen)) == -1) {                          if ((i = write(out, cp, wlen)) == -1) {

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.113