|
Lines 505-511
source(int argc, char **argv)
Link Here
|
| 505 |
BUF *bp; |
505 |
BUF *bp; |
| 506 |
off_t i, amt, result, statbytes; |
506 |
off_t i, amt, result, statbytes; |
| 507 |
int fd, haderr, indx; |
507 |
int fd, haderr, indx; |
| 508 |
char *last, *name, buf[2048]; |
508 |
char *last, *name, buf[2048], encname[MAXPATHLEN]; |
| 509 |
int len; |
509 |
int len; |
| 510 |
|
510 |
|
| 511 |
for (indx = 0; indx < argc; ++indx) { |
511 |
for (indx = 0; indx < argc; ++indx) { |
|
Lines 514-526
source(int argc, char **argv)
Link Here
|
| 514 |
len = strlen(name); |
514 |
len = strlen(name); |
| 515 |
while (len > 1 && name[len-1] == '/') |
515 |
while (len > 1 && name[len-1] == '/') |
| 516 |
name[--len] = '\0'; |
516 |
name[--len] = '\0'; |
| 517 |
if (strchr(name, '\n') != NULL) { |
|
|
| 518 |
run_err("%s: skipping, filename contains a newline", |
| 519 |
name); |
| 520 |
goto next; |
| 521 |
} |
| 522 |
if ((fd = open(name, O_RDONLY, 0)) < 0) |
517 |
if ((fd = open(name, O_RDONLY, 0)) < 0) |
| 523 |
goto syserr; |
518 |
goto syserr; |
|
|
519 |
if (strchr(name, '\n') != NULL) { |
| 520 |
strnvis(encname, name, sizeof(encname), VIS_NL); |
| 521 |
name = encname; |
| 522 |
error("DAZ: name %s", name); |
| 523 |
} |
| 524 |
if (fstat(fd, &stb) < 0) { |
524 |
if (fstat(fd, &stb) < 0) { |
| 525 |
syserr: run_err("%s: %s", name, strerror(errno)); |
525 |
syserr: run_err("%s: %s", name, strerror(errno)); |
| 526 |
goto next; |
526 |
goto next; |