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

Diff for /src/usr.bin/tftp/main.c between version 1.11 and 1.12

version 1.11, 2003/03/13 09:09:35 version 1.12, 2003/04/17 17:17:27
Line 35 
Line 35 
  */   */
   
 #ifndef lint  #ifndef lint
 static char copyright[] =  static const char copyright[] =
 "@(#) Copyright (c) 1983, 1993\n\  "@(#) Copyright (c) 1983, 1993\n\
         The Regents of the University of California.  All rights reserved.\n";          The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */  #endif /* not lint */
Line 44 
Line 44 
 #if 0  #if 0
 static char sccsid[] = "@(#)main.c      8.1 (Berkeley) 6/6/93";  static char sccsid[] = "@(#)main.c      8.1 (Berkeley) 6/6/93";
 #endif  #endif
 static char rcsid[] = "$OpenBSD$";  static const char rcsid[] = "$OpenBSD$";
 #endif /* not lint */  #endif /* not lint */
   
 /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */  /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
Line 379 
Line 379 
         }          }
                                 /* this assumes the target is a directory */                                  /* this assumes the target is a directory */
                                 /* on a remote unix system.  hmmmm.  */                                  /* on a remote unix system.  hmmmm.  */
         cp = strchr(targ, '\0');  
         *cp++ = '/';  
         for (n = 1; n < argc - 1; n++) {          for (n = 1; n < argc - 1; n++) {
                 strcpy(cp, tail(argv[n]));                  if (asprintf(&cp, "%s/%s", targ, tail(argv[n])) == -1)
                           err(1, "asprintf");
                 fd = open(argv[n], O_RDONLY);                  fd = open(argv[n], O_RDONLY);
                 if (fd < 0) {                  if (fd < 0) {
                         warn("open: %s", argv[n]);                          warn("open: %s", argv[n]);
Line 390 
Line 389 
                 }                  }
                 if (verbose)                  if (verbose)
                         printf("putting %s to %s:%s [%s]\n",                          printf("putting %s to %s:%s [%s]\n",
                                 argv[n], hostname, targ, mode);                                  argv[n], hostname, cp, mode);
                 peeraddr.sin_port = port;                  peeraddr.sin_port = port;
                 sendfile(fd, targ, mode);                  sendfile(fd, cp, mode);
                   free(cp);
         }          }
 }  }
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12