View | Details | Raw Unified | Return to bug 891 | Differences between
and this patch

Collapse All | Expand All

(-)scp.c (-6 / +6 lines)
Lines 90-95 Link Here
90
#include <string.h>
90
#include <string.h>
91
#include <time.h>
91
#include <time.h>
92
#include <unistd.h>
92
#include <unistd.h>
93
#include <vis.h>
93
94
94
#include "xmalloc.h"
95
#include "xmalloc.h"
95
#include "atomicio.h"
96
#include "atomicio.h"
Lines 569-575 source(int argc, char **argv) Link Here
569
	off_t i, amt, statbytes;
570
	off_t i, amt, statbytes;
570
	size_t result;
571
	size_t result;
571
	int fd = -1, haderr, indx;
572
	int fd = -1, haderr, indx;
572
	char *last, *name, buf[2048];
573
	char *last, *name, buf[2048], encname[MAXPATHLEN];
573
	int len;
574
	int len;
574
575
575
	for (indx = 0; indx < argc; ++indx) {
576
	for (indx = 0; indx < argc; ++indx) {
Lines 578-590 source(int argc, char **argv) Link Here
578
		len = strlen(name);
579
		len = strlen(name);
579
		while (len > 1 && name[len-1] == '/')
580
		while (len > 1 && name[len-1] == '/')
580
			name[--len] = '\0';
581
			name[--len] = '\0';
581
		if (strchr(name, '\n') != NULL) {
582
			run_err("%s: skipping, filename contains a newline",
583
			    name);
584
			goto next;
585
		}
586
		if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0)
582
		if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0)
587
			goto syserr;
583
			goto syserr;
584
		if (strchr(name, '\n') != NULL) {
585
			strnvis(encname, name, sizeof(encname), VIS_NL);
586
			name = encname;
587
	}
588
		if (fstat(fd, &stb) < 0) {
588
		if (fstat(fd, &stb) < 0) {
589
syserr:			run_err("%s: %s", name, strerror(errno));
589
syserr:			run_err("%s: %s", name, strerror(errno));
590
			goto next;
590
			goto next;

Return to bug 891