diff options
author | Darren Tucker <dtucker@zip.com.au> | 2009-10-11 12:52:10 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2009-10-11 12:52:10 +0200 |
commit | 438b47320cf075fa51aa0e840882998c24db176b (patch) | |
tree | 3d4a33aeb670c7e95f7dba390ddc37aa7e4c3fb5 /sftp-client.c | |
parent | - jmc@cvs.openbsd.org 2009/10/08 20:42:12 (diff) | |
download | openssh-438b47320cf075fa51aa0e840882998c24db176b.tar.xz openssh-438b47320cf075fa51aa0e840882998c24db176b.zip |
- 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@
Diffstat (limited to 'sftp-client.c')
-rw-r--r-- | sftp-client.c | 10 |
1 files changed, 7 insertions, 3 deletions
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 @@ -/* $OpenBSD: sftp-client.c,v 1.89 2009/08/18 18:36:20 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.90 2009/10/11 10:41:26 dtucker Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -1512,7 +1512,11 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, new_dst = path_append(dst, filename); new_src = path_append(src, filename); - if (S_ISDIR(DTTOIF(dp->d_type))) { + if (lstat(new_src, &sb) == -1) { + logit("%s: lstat failed: %s", filename, + strerror(errno)); + ret = -1; + } else if (S_ISDIR(sb.st_mode)) { if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) continue; @@ -1520,7 +1524,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, if (upload_dir_internal(conn, new_src, new_dst, pflag, depth + 1, printflag) == -1) ret = -1; - } else if (S_ISREG(DTTOIF(dp->d_type)) ) { + } else if (S_ISREG(sb.st_mode)) { if (do_upload(conn, new_src, new_dst, pflag) == -1) { error("Uploading of file %s to %s failed!", new_src, new_dst); |