diff options
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.98 2007/12/12 05:04:03 djm Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.99 2008/01/20 00:38:30 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -434,17 +434,6 @@ is_dir(char *path) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | static int | 436 | static int |
437 | is_reg(char *path) | ||
438 | { | ||
439 | struct stat sb; | ||
440 | |||
441 | if (stat(path, &sb) == -1) | ||
442 | fatal("stat %s: %s", path, strerror(errno)); | ||
443 | |||
444 | return(S_ISREG(sb.st_mode)); | ||
445 | } | ||
446 | |||
447 | static int | ||
448 | remote_is_dir(struct sftp_conn *conn, char *path) | 437 | remote_is_dir(struct sftp_conn *conn, char *path) |
449 | { | 438 | { |
450 | Attrib *a; | 439 | Attrib *a; |
@@ -532,6 +521,7 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag) | |||
532 | glob_t g; | 521 | glob_t g; |
533 | int err = 0; | 522 | int err = 0; |
534 | int i; | 523 | int i; |
524 | struct stat sb; | ||
535 | 525 | ||
536 | if (dst) { | 526 | if (dst) { |
537 | tmp_dst = xstrdup(dst); | 527 | tmp_dst = xstrdup(dst); |
@@ -540,7 +530,7 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag) | |||
540 | 530 | ||
541 | memset(&g, 0, sizeof(g)); | 531 | memset(&g, 0, sizeof(g)); |
542 | debug3("Looking up %s", src); | 532 | debug3("Looking up %s", src); |
543 | if (glob(src, 0, NULL, &g)) { | 533 | if (glob(src, GLOB_NOCHECK, NULL, &g)) { |
544 | error("File \"%s\" not found.", src); | 534 | error("File \"%s\" not found.", src); |
545 | err = -1; | 535 | err = -1; |
546 | goto out; | 536 | goto out; |
@@ -555,7 +545,13 @@ process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag) | |||
555 | } | 545 | } |
556 | 546 | ||
557 | for (i = 0; g.gl_pathv[i] && !interrupted; i++) { | 547 | for (i = 0; g.gl_pathv[i] && !interrupted; i++) { |
558 | if (!is_reg(g.gl_pathv[i])) { | 548 | if (stat(g.gl_pathv[i], &sb) == -1) { |
549 | err = -1; | ||
550 | error("stat %s: %s", g.gl_pathv[i], strerror(errno)); | ||
551 | continue; | ||
552 | } | ||
553 | |||
554 | if (!S_ISREG(sb.st_mode)) { | ||
559 | error("skipping non-regular file %s", | 555 | error("skipping non-regular file %s", |
560 | g.gl_pathv[i]); | 556 | g.gl_pathv[i]); |
561 | continue; | 557 | continue; |