summaryrefslogtreecommitdiffstats
path: root/twrpTar.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@yahoo.com>2013-06-19 21:53:57 +0200
committerDees_Troy <dees_troy@teamw.in>2013-07-01 22:48:43 +0200
commit59df9264e3568d3f147dcfa7c5f7945858eb2c65 (patch)
treed18812b2f8d06ac6bbf925b1e1825a1667c6d9fd /twrpTar.cpp
parentFix MTD Mounting (diff)
downloadandroid_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar.gz
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar.bz2
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar.lz
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar.xz
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.tar.zst
android_bootable_recovery-59df9264e3568d3f147dcfa7c5f7945858eb2c65.zip
Diffstat (limited to 'twrpTar.cpp')
-rw-r--r--twrpTar.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/twrpTar.cpp b/twrpTar.cpp
index bc7f37055..a27374abf 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -659,7 +659,7 @@ int twrpTar::extract() {
int twrpTar::tarDirs(bool include_root) {
DIR* d;
string mainfolder = tardir + "/", subfolder;
- char buf[PATH_MAX];
+ char buf[PATH_MAX], charTarPath[PATH_MAX];
char excl[1024];
string::size_type i;
@@ -697,26 +697,31 @@ int twrpTar::tarDirs(bool include_root) {
if (strcmp(de->d_name, ".") != 0) {
subfolder += de->d_name;
} else {
- LOGINFO("adding '%s'\n", subfolder.c_str());
+ LOGINFO("addFile '%s' including root: %i\n", buf, include_root);
if (addFile(subfolder, include_root) != 0)
return -1;
continue;
}
- LOGINFO("adding '%s'\n", subfolder.c_str());
strcpy(buf, subfolder.c_str());
if (de->d_type == DT_DIR) {
- char* charTarPath;
if (include_root) {
- charTarPath = NULL;
+ charTarPath[0] = NULL;
+ LOGINFO("tar_append_tree '%s' as NULL\n", buf, charTarPath);
+ if (tar_append_tree(t, buf, NULL, excl) != 0) {
+ LOGERR("Error appending '%s' to tar archive '%s'\n", buf, tarfn.c_str());
+ return -1;
+ }
} else {
string temp = Strip_Root_Dir(buf);
- charTarPath = (char*) temp.c_str();
- }
- if (tar_append_tree(t, buf, charTarPath, excl) != 0) {
- LOGERR("Error appending '%s' to tar archive '%s'\n", buf, tarfn.c_str());
- return -1;
+ strcpy(charTarPath, temp.c_str());
+ LOGINFO("tar_append_tree '%s' as '%s'\n", buf, charTarPath);
+ if (tar_append_tree(t, buf, charTarPath, excl) != 0) {
+ LOGERR("Error appending '%s' to tar archive '%s'\n", buf, tarfn.c_str());
+ return -1;
+ }
}
} else if (tardir != "/" && (de->d_type == DT_REG || de->d_type == DT_LNK)) {
+ LOGINFO("addFile '%s' including root: %i\n", buf, include_root);
if (addFile(buf, include_root) != 0)
return -1;
}