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

Diff for /src/usr.bin/tftp/tftp.c between version 1.6 and 1.7

version 1.6, 2000/12/07 18:13:14 version 1.7, 2001/03/22 01:34:01
Line 60 
Line 60 
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   #include <err.h>
   
 #include "extern.h"  #include "extern.h"
 #include "tftpsubs.h"  #include "tftpsubs.h"
Line 134 
Line 135 
                 n = sendto(f, dp, size + 4, 0,                  n = sendto(f, dp, size + 4, 0,
                     (struct sockaddr *)&peeraddr, sizeof(peeraddr));                      (struct sockaddr *)&peeraddr, sizeof(peeraddr));
                 if (n != size + 4) {                  if (n != size + 4) {
                         perror("tftp: sendto");                          warn("sendto");
                         goto abort;                          goto abort;
                 }                  }
                 read_ahead(file, convert);                  read_ahead(file, convert);
Line 147 
Line 148 
                         } while (n <= 0);                          } while (n <= 0);
                         alarm(0);                          alarm(0);
                         if (n < 0) {                          if (n < 0) {
                                 perror("tftp: recvfrom");                                  warn("recvfrom");
                                 goto abort;                                  goto abort;
                         }                          }
                         peeraddr.sin_port = from.sin_port;      /* added */                          peeraddr.sin_port = from.sin_port;      /* added */
Line 238 
Line 239 
                 if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&peeraddr,                  if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&peeraddr,
                     sizeof(peeraddr)) != size) {                      sizeof(peeraddr)) != size) {
                         alarm(0);                          alarm(0);
                         perror("tftp: sendto");                          warn("sendto");
                         goto abort;                          goto abort;
                 }                  }
                 write_behind(file, convert);                  write_behind(file, convert);
Line 251 
Line 252 
                         } while (n <= 0);                          } while (n <= 0);
                         alarm(0);                          alarm(0);
                         if (n < 0) {                          if (n < 0) {
                                 perror("tftp: recvfrom");                                  warn("recvfrom");
                                 goto abort;                                  goto abort;
                         }                          }
                         peeraddr.sin_port = from.sin_port;      /* added */                          peeraddr.sin_port = from.sin_port;      /* added */
Line 351 
Line 352 
         register struct errmsg *pe;          register struct errmsg *pe;
         register struct tftphdr *tp;          register struct tftphdr *tp;
         int length;          int length;
         char *strerror();  
   
         tp = (struct tftphdr *)ackbuf;          tp = (struct tftphdr *)ackbuf;
         tp->th_opcode = htons((u_short)ERROR);          tp->th_opcode = htons((u_short)ERROR);
Line 369 
Line 369 
                 tpacket("sent", tp, length);                  tpacket("sent", tp, length);
         if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&peeraddr,          if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&peeraddr,
             sizeof(peeraddr)) != length)              sizeof(peeraddr)) != length)
                 perror("nak");                  warn("nak");
 }  }
   
 static void  static void

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7