From 92c5462adef87b1e577b8557b6b9c64d5a089544 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 30 Oct 2018 13:12:34 +0800 Subject: idevicebackup2: Fix scan_directory() for platforms not having d_type in struct dirent --- tools/idevicebackup2.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/idevicebackup2.c') diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 02611a1..f7ea53a 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -254,7 +254,13 @@ static void scan_directory(const char *path, struct entry **files, struct entry } char *fpath = string_build_path(path, ep->d_name, NULL); if (fpath) { +#ifdef HAVE_DIRENT_D_TYPE if (ep->d_type & DT_DIR) { +#else + struct stat st; + if (stat(fpath, &st) != 0) return; + if (S_ISDIR(st.st_mode)) { +#endif struct entry *ent = malloc(sizeof(struct entry)); if (!ent) return; ent->name = fpath; -- cgit v1.1-32-gdbae