=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tftp/main.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/tftp/main.c 2003/03/13 09:09:35 1.11 --- src/usr.bin/tftp/main.c 2003/04/17 17:17:27 1.12 *************** *** 1,4 **** ! /* $OpenBSD: main.c,v 1.11 2003/03/13 09:09:35 deraadt Exp $ */ /* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: main.c,v 1.12 2003/04/17 17:17:27 henning Exp $ */ /* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */ /* *************** *** 35,41 **** */ #ifndef lint ! static char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ --- 35,41 ---- */ #ifndef lint ! static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: main.c,v 1.11 2003/03/13 09:09:35 deraadt Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ --- 44,50 ---- #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif ! static const char rcsid[] = "$OpenBSD: main.c,v 1.12 2003/04/17 17:17:27 henning Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ *************** *** 379,388 **** } /* this assumes the target is a directory */ /* on a remote unix system. hmmmm. */ - cp = strchr(targ, '\0'); - *cp++ = '/'; for (n = 1; n < argc - 1; n++) { ! strcpy(cp, tail(argv[n])); fd = open(argv[n], O_RDONLY); if (fd < 0) { warn("open: %s", argv[n]); --- 379,387 ---- } /* this assumes the target is a directory */ /* on a remote unix system. hmmmm. */ for (n = 1; n < argc - 1; n++) { ! if (asprintf(&cp, "%s/%s", targ, tail(argv[n])) == -1) ! err(1, "asprintf"); fd = open(argv[n], O_RDONLY); if (fd < 0) { warn("open: %s", argv[n]); *************** *** 390,398 **** } if (verbose) printf("putting %s to %s:%s [%s]\n", ! argv[n], hostname, targ, mode); peeraddr.sin_port = port; ! sendfile(fd, targ, mode); } } --- 389,398 ---- } if (verbose) printf("putting %s to %s:%s [%s]\n", ! argv[n], hostname, cp, mode); peeraddr.sin_port = port; ! sendfile(fd, cp, mode); ! free(cp); } }