[scp.c]
     remove trailing / from source paths; fixes pr#1756
This commit is contained in:
Ben Lindstrom 2001-04-07 01:14:38 +00:00
parent e34ab4c04e
commit d47cf4d53c
2 changed files with 9 additions and 2 deletions

View File

@ -9,6 +9,9 @@
more useful. more useful.
based on discussion with <mats@mindbright.se> long time ago based on discussion with <mats@mindbright.se> long time ago
and recent mail from <res@shore.net> and recent mail from <res@shore.net>
- deraadt@cvs.openbsd.org 2001/04/06 16:46:59
[scp.c]
remove trailing / from source paths; fixes pr#1756
20010406 20010406
- (stevesk) logintest.c: fix for systems without __progname - (stevesk) logintest.c: fix for systems without __progname
@ -4920,4 +4923,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1076 2001/04/07 01:12:11 mouring Exp $ $Id: ChangeLog,v 1.1077 2001/04/07 01:14:38 mouring Exp $

6
scp.c
View File

@ -75,7 +75,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: scp.c,v 1.64 2001/03/28 20:04:38 stevesk Exp $"); RCSID("$OpenBSD: scp.c,v 1.65 2001/04/06 16:46:59 deraadt Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "atomicio.h" #include "atomicio.h"
@ -500,10 +500,14 @@ source(argc, argv)
off_t i; off_t i;
int amt, fd, haderr, indx, result; int amt, fd, haderr, indx, result;
char *last, *name, buf[2048]; char *last, *name, buf[2048];
int len;
for (indx = 0; indx < argc; ++indx) { for (indx = 0; indx < argc; ++indx) {
name = argv[indx]; name = argv[indx];
statbytes = 0; statbytes = 0;
len = strlen(name);
while (len > 1 && name[len-1] == '/')
name[--len] = '\0';
if ((fd = open(name, O_RDONLY, 0)) < 0) if ((fd = open(name, O_RDONLY, 0)) < 0)
goto syserr; goto syserr;
if (fstat(fd, &stb) < 0) { if (fstat(fd, &stb) < 0) {