[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.187 and 1.188

version 1.187, 2020/01/21 05:02:53 version 1.188, 2020/02/13 15:47:33
Line 1045 
Line 1045 
                 if (error == -1)                  if (error == -1)
                         goto cleanup_url_get;                          goto cleanup_url_get;
         } else {          } else {
                 i = 0;                  while ((len = fread(buf, 1, buflen, fin)) > 0) {
                 len = 1;  
                 while (len > 0) {  
                         len = fread(buf, 1, buflen, fin);  
                         bytes += len;                          bytes += len;
                         for (cp = buf, wlen = len; wlen > 0; wlen -= i, cp += i) {                          for (cp = buf; len > 0; len -= wlen, cp += wlen) {
                                 if ((i = write(out, cp, wlen)) == -1) {                                  if ((wlen = write(out, cp, len)) == -1) {
                                         warn("Writing %s", savefile);                                          warn("Writing %s", savefile);
                                         signal(SIGINFO, oldinti);                                          signal(SIGINFO, oldinti);
                                         goto cleanup_url_get;                                          goto cleanup_url_get;
                                 } else if (i == 0)                                  }
                                         break;  
                         }                          }
                         if (hash && !progress) {                          if (hash && !progress) {
                                 while (bytes >= hashbytes) {                                  while (bytes >= hashbytes) {
Line 1066 
Line 1062 
                                 (void)fflush(ttyout);                                  (void)fflush(ttyout);
                         }                          }
                 }                  }
                   save_errno = errno;
                 signal(SIGINFO, oldinti);                  signal(SIGINFO, oldinti);
                 if (hash && !progress && bytes > 0) {                  if (hash && !progress && bytes > 0) {
                         if (bytes < mark)                          if (bytes < mark)
Line 1073 
Line 1070 
                         (void)putc('\n', ttyout);                          (void)putc('\n', ttyout);
                         (void)fflush(ttyout);                          (void)fflush(ttyout);
                 }                  }
                 if (len != 0) {                  if (len == 0 && ferror(fin)) {
                           errno = save_errno;
                         warnx("Reading from socket: %s", sockerror(tls));                          warnx("Reading from socket: %s", sockerror(tls));
                         goto cleanup_url_get;                          goto cleanup_url_get;
                 }                  }

Legend:
Removed from v.1.187  
changed lines
  Added in v.1.188