summaryrefslogtreecommitdiffstats
path: root/fixPermissions.cpp
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2013-01-09 15:09:08 +0100
committerbigbiff bigbiff <bigbiff@teamw.in>2013-01-09 15:09:08 +0100
commit9c754053b07a724bdd98d039f34899d6a49115b7 (patch)
tree464885db361a12d83d60cf152142c765562bb92d /fixPermissions.cpp
parentAdd Samsung TouchWiz decryption (diff)
downloadandroid_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.gz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.bz2
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.lz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.xz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.zst
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.zip
Diffstat (limited to 'fixPermissions.cpp')
-rw-r--r--fixPermissions.cpp42
1 files changed, 2 insertions, 40 deletions
diff --git a/fixPermissions.cpp b/fixPermissions.cpp
index 801e27374..16a3f33f2 100644
--- a/fixPermissions.cpp
+++ b/fixPermissions.cpp
@@ -220,44 +220,6 @@ int fixPermissions::pchmod(string fn, string mode) {
return 0;
}
-int fixPermissions::removeDir(const string path) {
- DIR *d = opendir(path.c_str());
- int r = 0;
- string new_path;
-
- if (d == NULL) {
- LOGE("Error opening '%s'\n", path.c_str());
- return -1;
- }
-
- if (d) {
- struct dirent *p;
- while (!r && (p = readdir(d))) {
- if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, ".."))
- continue;
-
- new_path = path + "/";
- new_path.append(p->d_name);
- if (p->d_type == DT_DIR) {
- r = removeDir(new_path);
- if (!r)
- LOGI("Unable to removeDir '%s'\n", new_path.c_str());
- } else {
- r = unlink(new_path.c_str());
- if (!r)
- LOGI("Unable to unlink '%s'\n", new_path.c_str());
- }
- }
- closedir(d);
- }
- if (!r)
- r = rmdir(path.c_str());
- if (!r)
- LOGI("Unable to rmdir '%s'\n", path.c_str());
-
- return r;
-}
-
int fixPermissions::fixSystemApps() {
temp = head;
while (temp != NULL) {
@@ -279,7 +241,7 @@ int fixPermissions::fixSystemApps() {
if (remove_data && TWFunc::Path_Exists(temp->dDir) && temp->appDir.size() >= 9 && temp->appDir.substr(0, 9) != "/mnt/asec") {
if (debug)
LOGI("Looking at '%s', removing data dir: '%s', appDir: '%s'", temp->codePath.c_str(), temp->dDir.c_str(), temp->appDir.c_str());
- if (removeDir(temp->dDir) != 0) {
+ if (TWFunc::removeDir(temp->dDir, false) != 0) {
LOGI("Unable to removeDir '%s'\n", temp->dDir.c_str());
return -1;
}
@@ -325,7 +287,7 @@ int fixPermissions::fixDataApps() {
if (remove_data && TWFunc::Path_Exists(temp->dDir) && temp->appDir.size() >= 9 && temp->appDir.substr(0, 9) != "/mnt/asec") {
if (debug)
LOGI("Looking at '%s', removing data dir: '%s', appDir: '%s'", temp->codePath.c_str(), temp->dDir.c_str(), temp->appDir.c_str());
- if (removeDir(temp->dDir) != 0) {
+ if (TWFunc::removeDir(temp->dDir, false) != 0) {
LOGI("Unable to removeDir '%s'\n", temp->dDir.c_str());
return -1;
}