diff options
author | Darren Tucker <dtucker@zip.com.au> | 2009-10-11 21:52:10 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2009-10-11 21:52:10 +1100 |
commit | 438b47320cf075fa51aa0e840882998c24db176b (patch) | |
tree | 3d4a33aeb670c7e95f7dba390ddc37aa7e4c3fb5 | |
parent | 7a4a76579e5321f52b773fc84f7bbe0f07adc5f2 (diff) |
- dtucker@cvs.openbsd.org 2009/10/11 10:41:26
[sftp-client.c]
d_type isn't portable so use lstat to get dirent modes. Suggested by and
"looks sane" deraadt@
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | sftp-client.c | 10 |
2 files changed, 11 insertions, 3 deletions
@@ -10,6 +10,10 @@ | |||
10 | - jmc@cvs.openbsd.org 2009/10/08 20:42:12 | 10 | - jmc@cvs.openbsd.org 2009/10/08 20:42:12 |
11 | [sshd_config.5 ssh_config.5 sshd.8 ssh.1] | 11 | [sshd_config.5 ssh_config.5 sshd.8 ssh.1] |
12 | some tweaks now that protocol 1 is not offered by default; ok markus | 12 | some tweaks now that protocol 1 is not offered by default; ok markus |
13 | - dtucker@cvs.openbsd.org 2009/10/11 10:41:26 | ||
14 | [sftp-client.c] | ||
15 | d_type isn't portable so use lstat to get dirent modes. Suggested by and | ||
16 | "looks sane" deraadt@ | ||
13 | 17 | ||
14 | 20091007 | 18 | 20091007 |
15 | - (dtucker) OpenBSD CVS Sync | 19 | - (dtucker) OpenBSD CVS Sync |
diff --git a/sftp-client.c b/sftp-client.c index cc4a5b15b..6124c0f40 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-client.c,v 1.89 2009/08/18 18:36:20 djm Exp $ */ | 1 | /* $OpenBSD: sftp-client.c,v 1.90 2009/10/11 10:41:26 dtucker 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 | * |
@@ -1512,7 +1512,11 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, | |||
1512 | new_dst = path_append(dst, filename); | 1512 | new_dst = path_append(dst, filename); |
1513 | new_src = path_append(src, filename); | 1513 | new_src = path_append(src, filename); |
1514 | 1514 | ||
1515 | if (S_ISDIR(DTTOIF(dp->d_type))) { | 1515 | if (lstat(new_src, &sb) == -1) { |
1516 | logit("%s: lstat failed: %s", filename, | ||
1517 | strerror(errno)); | ||
1518 | ret = -1; | ||
1519 | } else if (S_ISDIR(sb.st_mode)) { | ||
1516 | if (strcmp(filename, ".") == 0 || | 1520 | if (strcmp(filename, ".") == 0 || |
1517 | strcmp(filename, "..") == 0) | 1521 | strcmp(filename, "..") == 0) |
1518 | continue; | 1522 | continue; |
@@ -1520,7 +1524,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, | |||
1520 | if (upload_dir_internal(conn, new_src, new_dst, | 1524 | if (upload_dir_internal(conn, new_src, new_dst, |
1521 | pflag, depth + 1, printflag) == -1) | 1525 | pflag, depth + 1, printflag) == -1) |
1522 | ret = -1; | 1526 | ret = -1; |
1523 | } else if (S_ISREG(DTTOIF(dp->d_type)) ) { | 1527 | } else if (S_ISREG(sb.st_mode)) { |
1524 | if (do_upload(conn, new_src, new_dst, pflag) == -1) { | 1528 | if (do_upload(conn, new_src, new_dst, pflag) == -1) { |
1525 | error("Uploading of file %s to %s failed!", | 1529 | error("Uploading of file %s to %s failed!", |
1526 | new_src, new_dst); | 1530 | new_src, new_dst); |