summaryrefslogtreecommitdiffstats
path: root/mtp/MtpServer.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-09-04 19:59:27 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-09-04 20:05:35 +0200
commit241a3ce4c5ff883c160754e0aebd1e1b0894d332 (patch)
treee39901d3a8b91ad599ec71754dfeba7cdea8dcc1 /mtp/MtpServer.cpp
parentMTP Fix rename in Windows (diff)
downloadandroid_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar.gz
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar.bz2
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar.lz
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar.xz
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.tar.zst
android_bootable_recovery-241a3ce4c5ff883c160754e0aebd1e1b0894d332.zip
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 {