diff options
author | Darren Tucker <dtucker@zip.com.au> | 2009-10-07 18:56:10 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2009-10-07 18:56:10 +1100 |
commit | 538738d861cefb25d78615b1c299d7b618db870c (patch) | |
tree | 91c08e223cf51d20a369af1e0711f3559ae9bd9e | |
parent | 4adeac764e110e12ab481dc72c7c67dbf4b7110a (diff) |
- (dtucker) d_type is not mandated by POSIX, so add fallback code using
stat(), needed on at least cygwin.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | sftp-client.c | 18 |
3 files changed, 23 insertions, 5 deletions
@@ -117,8 +117,10 @@ | |||
117 | [regress/ssh2putty.sh] | 117 | [regress/ssh2putty.sh] |
118 | Add OpenBSD tag to make syncs easier | 118 | Add OpenBSD tag to make syncs easier |
119 | - (dtucker) [regress/portnum.sh] Import new test. | 119 | - (dtucker) [regress/portnum.sh] Import new test. |
120 | - (dtucker) [configure.ac sftp-client.c] DOTTIF is in fs/ffs/dir.h on at | 120 | - (dtucker) [configure.ac sftp-client.c] DTOTIF is in fs/ffs/dir.h on at |
121 | least dragonflybsd. | 121 | least dragonflybsd. |
122 | - (dtucker) d_type is not mandated by POSIX, so add fallback code using | ||
123 | stat(), needed on at least cygwin. | ||
122 | 124 | ||
123 | 20091002 | 125 | 20091002 |
124 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. | 126 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. |
diff --git a/configure.ac b/configure.ac index 759047f10..80db43af1 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.428 2009/10/07 04:49:48 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.429 2009/10/07 07:56:10 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,7 +15,7 @@ | |||
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | ||
17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) | 17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) |
18 | AC_REVISION($Revision: 1.428 $) | 18 | AC_REVISION($Revision: 1.429 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | 20 | ||
21 | AC_CONFIG_HEADER(config.h) | 21 | AC_CONFIG_HEADER(config.h) |
@@ -1137,6 +1137,8 @@ AC_CHECK_DECL(DTTOIF, | |||
1137 | #include <fs/ffs/dir.h> | 1137 | #include <fs/ffs/dir.h> |
1138 | ]) | 1138 | ]) |
1139 | 1139 | ||
1140 | AC_CHECK_MEMBERS([struct dirent.d_type],,, [#include <dirent.h>]) | ||
1141 | |||
1140 | AC_MSG_CHECKING([for /proc/pid/fd directory]) | 1142 | AC_MSG_CHECKING([for /proc/pid/fd directory]) |
1141 | if test -d "/proc/$$/fd" ; then | 1143 | if test -d "/proc/$$/fd" ; then |
1142 | AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd]) | 1144 | AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd]) |
diff --git a/sftp-client.c b/sftp-client.c index b49e81b91..a9c895a0d 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -1454,6 +1454,20 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path, | |||
1454 | return status; | 1454 | return status; |
1455 | } | 1455 | } |
1456 | 1456 | ||
1457 | static mode_t | ||
1458 | dirent_to_mode(struct dirent *dp) | ||
1459 | { | ||
1460 | #if defined(HAVE_STRUCT_DIRENT_D_TYPE) && defined(DTTOIF) | ||
1461 | return DTTOIF(dp->d_type); | ||
1462 | #else | ||
1463 | struct stat sb; | ||
1464 | |||
1465 | if (stat(dp->d_name, &sb) == -1) | ||
1466 | return 0; | ||
1467 | return sb.st_mode; | ||
1468 | #endif | ||
1469 | } | ||
1470 | |||
1457 | static int | 1471 | static int |
1458 | upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, | 1472 | upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, |
1459 | int pflag, int printflag, int depth) | 1473 | int pflag, int printflag, int depth) |
@@ -1515,7 +1529,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, | |||
1515 | new_dst = path_append(dst, filename); | 1529 | new_dst = path_append(dst, filename); |
1516 | new_src = path_append(src, filename); | 1530 | new_src = path_append(src, filename); |
1517 | 1531 | ||
1518 | if (S_ISDIR(DTTOIF(dp->d_type))) { | 1532 | if (S_ISDIR(dirent_to_mode(dp))) { |
1519 | if (strcmp(filename, ".") == 0 || | 1533 | if (strcmp(filename, ".") == 0 || |
1520 | strcmp(filename, "..") == 0) | 1534 | strcmp(filename, "..") == 0) |
1521 | continue; | 1535 | continue; |
@@ -1523,7 +1537,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, | |||
1523 | if (upload_dir_internal(conn, new_src, new_dst, | 1537 | if (upload_dir_internal(conn, new_src, new_dst, |
1524 | pflag, depth + 1, printflag) == -1) | 1538 | pflag, depth + 1, printflag) == -1) |
1525 | ret = -1; | 1539 | ret = -1; |
1526 | } else if (S_ISREG(DTTOIF(dp->d_type)) ) { | 1540 | } else if (S_ISREG(dirent_to_mode(dp))) { |
1527 | if (do_upload(conn, new_src, new_dst, pflag) == -1) { | 1541 | if (do_upload(conn, new_src, new_dst, pflag) == -1) { |
1528 | error("Uploading of file %s to %s failed!", | 1542 | error("Uploading of file %s to %s failed!", |
1529 | new_src, new_dst); | 1543 | new_src, new_dst); |