summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2009-10-11 21:50:20 +1100
committerDarren Tucker <dtucker@zip.com.au>2009-10-11 21:50:20 +1100
commitc182d993762f86fbdf9e54dd5b0e3e3d229ebc13 (patch)
treec2d047591f1534a0184f0d578ff9f40172937a3c /sftp-client.c
parent538738d861cefb25d78615b1c299d7b618db870c (diff)
- (dtucker) [configure.ac sftp-client.c] Remove the gyrations required for
dirent d_type and DTTOIF as we've switched OpenBSD to the more portable lstat.
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/sftp-client.c b/sftp-client.c
index a9c895a0d..cc4a5b15b 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -37,9 +37,6 @@
37#include <sys/uio.h> 37#include <sys/uio.h>
38 38
39#include <dirent.h> 39#include <dirent.h>
40#ifdef DTTOIF_IN_FS_FFS_DIR_H
41# include <fs/ffs/dir.h>
42#endif
43#include <errno.h> 40#include <errno.h>
44#include <fcntl.h> 41#include <fcntl.h>
45#include <signal.h> 42#include <signal.h>
@@ -1454,20 +1451,6 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1454 return status; 1451 return status;
1455} 1452}
1456 1453
1457static mode_t
1458dirent_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
1471static int 1454static int
1472upload_dir_internal(struct sftp_conn *conn, char *src, char *dst, 1455upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
1473 int pflag, int printflag, int depth) 1456 int pflag, int printflag, int depth)
@@ -1529,7 +1512,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
1529 new_dst = path_append(dst, filename); 1512 new_dst = path_append(dst, filename);
1530 new_src = path_append(src, filename); 1513 new_src = path_append(src, filename);
1531 1514
1532 if (S_ISDIR(dirent_to_mode(dp))) { 1515 if (S_ISDIR(DTTOIF(dp->d_type))) {
1533 if (strcmp(filename, ".") == 0 || 1516 if (strcmp(filename, ".") == 0 ||
1534 strcmp(filename, "..") == 0) 1517 strcmp(filename, "..") == 0)
1535 continue; 1518 continue;
@@ -1537,7 +1520,7 @@ upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
1537 if (upload_dir_internal(conn, new_src, new_dst, 1520 if (upload_dir_internal(conn, new_src, new_dst,
1538 pflag, depth + 1, printflag) == -1) 1521 pflag, depth + 1, printflag) == -1)
1539 ret = -1; 1522 ret = -1;
1540 } else if (S_ISREG(dirent_to_mode(dp))) { 1523 } else if (S_ISREG(DTTOIF(dp->d_type)) ) {
1541 if (do_upload(conn, new_src, new_dst, pflag) == -1) { 1524 if (do_upload(conn, new_src, new_dst, pflag) == -1) {
1542 error("Uploading of file %s to %s failed!", 1525 error("Uploading of file %s to %s failed!",
1543 new_src, new_dst); 1526 new_src, new_dst);