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

Diff for /src/usr.bin/ftp/ftp.c between version 1.19 and 1.20

version 1.19, 1997/06/17 20:40:40 version 1.20, 1997/07/25 21:56:21
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: ftp.c,v 1.25 1997/04/14 09:09:22 lukem Exp $   */  /*      $NetBSD: ftp.c,v 1.26 1997/07/20 09:45:53 lukem Exp $   */
   
 /*  /*
  * Copyright (c) 1985, 1989, 1993, 1994   * Copyright (c) 1985, 1989, 1993, 1994
Line 86 
Line 86 
 char *  char *
 hookup(host, port)  hookup(host, port)
         const char *host;          const char *host;
         int port;          in_port_t port;
 {  {
         struct hostent *hp = 0;          struct hostent *hp = NULL;
         int s, len, tos;          int s, len, tos;
         static char hostnamebuf[MAXHOSTNAMELEN];          static char hostnamebuf[MAXHOSTNAMELEN];
   
Line 105 
Line 105 
                         return ((char *) 0);                          return ((char *) 0);
                 }                  }
                 hisctladdr.sin_family = hp->h_addrtype;                  hisctladdr.sin_family = hp->h_addrtype;
                 memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0], hp->h_length);                  memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0],
                       (size_t)hp->h_length);
                 (void)strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf) - 1);                  (void)strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf) - 1);
                 hostnamebuf[sizeof(hostnamebuf) - 1] = '\0';                  hostnamebuf[sizeof(hostnamebuf) - 1] = '\0';
         }          }
Line 128 
Line 129 
                         warn("connect to address %s", ia);                          warn("connect to address %s", ia);
                         hp->h_addr_list++;                          hp->h_addr_list++;
                         memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0],                          memcpy(&hisctladdr.sin_addr, hp->h_addr_list[0],
                             hp->h_length);                              (size_t)hp->h_length);
                         fprintf(ttyout, "Trying %s...\n", inet_ntoa(hisctladdr.sin_addr));                          fprintf(ttyout, "Trying %s...\n", inet_ntoa(hisctladdr.sin_addr));
                         (void)close(s);                          (void)close(s);
                         s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);                          s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
Line 415 
Line 416 
 {  {
         struct stat st;          struct stat st;
         int c, d;          int c, d;
         FILE *fin, *dout = 0;          FILE *fin, *dout;
         int (*closefunc) __P((FILE *));          int (*closefunc) __P((FILE *));
         sig_t oldinti, oldintr, oldintp;          sig_t oldinti, oldintr, oldintp;
         off_t hashbytes;          volatile off_t hashbytes;
         char *lmode, buf[BUFSIZ], *bufp;          char *lmode, buf[BUFSIZ], *bufp;
         int oprogress;          int oprogress;
   
   #ifdef __GNUC__                         /* XXX: to shut up gcc warnings */
           (void)&fin;
           (void)&dout;
           (void)&closefunc;
           (void)&oldinti;
           (void)&oldintr;
           (void)&oldintp;
           (void)&lmode;
   #endif
   
         hashbytes = mark;          hashbytes = mark;
         direction = "sent";          direction = "sent";
           dout = NULL;
         bytes = 0;          bytes = 0;
         filesize = -1;          filesize = -1;
         oprogress = progress;          oprogress = progress;
Line 583 
Line 595 
                 while ((c = read(fileno(fin), buf, sizeof(buf))) > 0) {                  while ((c = read(fileno(fin), buf, sizeof(buf))) > 0) {
                         bytes += c;                          bytes += c;
                         for (bufp = buf; c > 0; c -= d, bufp += d)                          for (bufp = buf; c > 0; c -= d, bufp += d)
                                 if ((d = write(fileno(dout), bufp, c)) <= 0)                                  if ((d = write(fileno(dout), bufp, (size_t)c))
                                       <= 0)
                                         break;                                          break;
                         if (hash && (!progress || filesize < 0) ) {                          if (hash && (!progress || filesize < 0) ) {
                                 while (bytes >= hashbytes) {                                  while (bytes >= hashbytes) {
Line 703 
Line 716 
         const char *cmd, *local, *remote, *lmode;          const char *cmd, *local, *remote, *lmode;
         int printnames;          int printnames;
 {  {
         FILE *fout, *din = 0;          FILE *fout, *din;
         int (*closefunc) __P((FILE *));          int (*closefunc) __P((FILE *));
         sig_t oldinti, oldintr, oldintp;          sig_t oldinti, oldintr, oldintp;
         int c, d, is_retr, tcrflag, bare_lfs = 0;          int c, d;
         static int bufsize;          volatile int is_retr, tcrflag, bare_lfs;
           static size_t bufsize;
         static char *buf;          static char *buf;
         off_t hashbytes;          volatile off_t hashbytes;
         struct stat st;          struct stat st;
         time_t mtime;          time_t mtime;
         int oprogress;          int oprogress;
         int opreserve;          int opreserve;
   
   #ifdef __GNUC__                         /* XXX: to shut up gcc warnings */
           (void)&local;
           (void)&fout;
           (void)&din;
           (void)&closefunc;
           (void)&oldinti;
           (void)&oldintr;
           (void)&oldintp;
   #endif
   
           fout = NULL;
           din = NULL;
           oldinti = NULL;
         hashbytes = mark;          hashbytes = mark;
         direction = "received";          direction = "received";
         bytes = 0;          bytes = 0;
           bare_lfs = 0;
         filesize = -1;          filesize = -1;
         oprogress = progress;          oprogress = progress;
         opreserve = preserve;          opreserve = preserve;
Line 779 
Line 807 
                                 return;                                  return;
                         }                          }
                         if (!runique && errno == EACCES &&                          if (!runique && errno == EACCES &&
                             chmod(local, 0600) < 0) {                              chmod(local, (S_IRUSR|S_IWUSR)) < 0) {
                                 warn("local: %s", local);                                  warn("local: %s", local);
                                 (void)signal(SIGINT, oldintr);                                  (void)signal(SIGINT, oldintr);
                                 (void)signal(SIGINFO, oldinti);                                  (void)signal(SIGINFO, oldinti);
Line 891 
Line 919 
                 }                  }
                 errno = d = 0;                  errno = d = 0;
                 while ((c = read(fileno(din), buf, bufsize)) > 0) {                  while ((c = read(fileno(din), buf, bufsize)) > 0) {
                         if ((d = write(fileno(fout), buf, c)) != c)                          if ((d = write(fileno(fout), buf, (size_t)c)) != c)
                                 break;                                  break;
                         bytes += c;                          bytes += c;
                         if (hash && (!progress || filesize < 0)) {                          if (hash && (!progress || filesize < 0)) {
Line 1343 
Line 1371 
         const char *cmd, *local, *remote;          const char *cmd, *local, *remote;
 {  {
         sig_t oldintr;          sig_t oldintr;
         int secndflag = 0, prox_type, nfnd;          int prox_type, nfnd;
           volatile int secndflag;
         char *cmd2;          char *cmd2;
         struct fd_set mask;          struct fd_set mask;
   
   #ifdef __GNUC__                         /* XXX: to shut up gcc warnings */
           (void)&oldintr;
           (void)&cmd2;
   #endif
   
           oldintr = NULL;
           secndflag = 0;
         if (strcmp(cmd, "RETR"))          if (strcmp(cmd, "RETR"))
                 cmd2 = "RETR";                  cmd2 = "RETR";
         else          else

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20