From 2e9b5c034b1f33f320da315a8aeacac22eb934b5 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 8 Feb 2017 15:05:19 +1100 Subject: [PATCH] util/disk_cache: use stat() to check if entry is a directory d_type is not supported on all systems. --- src/util/disk_cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index a70bd66..8fcd091 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -542,7 +542,10 @@ unlink_random_file_from_directory(const char *path) static bool is_two_character_sub_directory(struct dirent *entry) { - if (entry->d_type != DT_DIR) + struct stat sb; + stat(entry->d_name, &sb); + + if (!S_ISDIR(sb.st_mode)) return false; if (strlen(entry->d_name) != 2) -- 2.9.3