return status;
}
+static mode_t
+dirent_to_mode(struct dirent *dp)
+{
+#if defined(HAVE_STRUCT_DIRENT_D_TYPE) && defined(DTTOIF)
+ return DTTOIF(dp->d_type);
+#else
+ struct stat sb;
+
+ if (stat(dp->d_name, &sb) == -1)
+ return 0;
+ return sb.st_mode;
+#endif
+}
+
static int
upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
int pflag, int printflag, int depth)
new_dst = path_append(dst, filename);
new_src = path_append(src, filename);
- if (S_ISDIR(DTTOIF(dp->d_type))) {
+ if (S_ISDIR(dirent_to_mode(dp))) {
if (strcmp(filename, ".") == 0 ||
strcmp(filename, "..") == 0)
continue;
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(dirent_to_mode(dp))) {
if (do_upload(conn, new_src, new_dst, pflag) == -1) {
error("Uploading of file %s to %s failed!",
new_src, new_dst);