Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9eb5ac9c authored by Mike Lockwood's avatar Mike Lockwood
Browse files

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: default avatarMike Lockwood <lockwood@android.com>
parent f30218be
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
        }
    }