summaryrefslogtreecommitdiffstats
path: root/mtp/MtpServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmtp/MtpServer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/mtp/MtpServer.cpp b/mtp/MtpServer.cpp
index 5dec5801e..c044cad7f 100755
--- a/mtp/MtpServer.cpp
+++ b/mtp/MtpServer.cpp
@@ -1132,7 +1132,12 @@ static void deleteRecursive(const char* path) {
strcpy(fileSpot, name);
int type = entry->d_type;
- if (entry->d_type == DT_DIR) {
+ struct stat st;
+ if (lstat(pathbuf, &st)) {
+ MTPE("Failed to lstat '%s'\n", pathbuf);
+ continue;
+ }
+ if (st.st_mode & S_IFDIR) {
deleteRecursive(pathbuf);
rmdir(pathbuf);
} else {