summaryrefslogtreecommitdiffstats
path: root/media/mtp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-06-14 23:00:30 -0700
committerMike Lockwood <lockwood@android.com>2010-06-14 23:00:30 -0700
commit6084a2964e346a036b58b1f4565ccbdefd518234 (patch)
tree1a7571d7e2e0c9bf8b44b9983f3be0a5d6fb40b1 /media/mtp
parentef04e8f230e7ef5dece1cc4e73cd109c69905418 (diff)
downloadframeworks_av-6084a2964e346a036b58b1f4565ccbdefd518234.zip
frameworks_av-6084a2964e346a036b58b1f4565ccbdefd518234.tar.gz
frameworks_av-6084a2964e346a036b58b1f4565ccbdefd518234.tar.bz2
MTP: Use stat.st_mode instead of dirent.d_type to determine file type.
dirent.d_type is not implemented on all file systems. Change-Id: I50a01fd77a9f976f215e7ff98dd04f0f2611bbce Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp')
-rw-r--r--media/mtp/MtpMediaScanner.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/mtp/MtpMediaScanner.cpp b/media/mtp/MtpMediaScanner.cpp
index 4e566f1..1db1b9d 100644
--- a/media/mtp/MtpMediaScanner.cpp
+++ b/media/mtp/MtpMediaScanner.cpp
@@ -294,7 +294,7 @@ int MtpMediaScanner::scanDirectory(const char* path, MtpObjectHandle parent)
memset(&statbuf, 0, sizeof(statbuf));
stat(buffer, &statbuf);
- if (entry->d_type == DT_DIR) {
+ if (S_ISDIR(statbuf.st_mode)) {
MtpObjectHandle handle = mDatabase->getObjectHandle(buffer);
if (handle) {
markFile(handle);
@@ -303,7 +303,7 @@ int MtpMediaScanner::scanDirectory(const char* path, MtpObjectHandle parent)
parent, mStorageID, 0, statbuf.st_mtime);
}
scanDirectory(buffer, handle);
- } else if (entry->d_type == DT_REG) {
+ } else if (S_ISREG(statbuf.st_mode)) {
scanFile(buffer, parent, statbuf);
}
}