summaryrefslogtreecommitdiffstats
path: root/twrpTar.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-11-30 19:29:37 +0100
committerEthan Yonker <dees_troy@teamw.in>2016-11-30 20:19:08 +0100
commit3fdcda46629e8e7fc19e89c51350b1e6f151e05e (patch)
treec392e0fdcf8e61e5abfb88099fd8d9b1f1ff8a70 /twrpTar.cpp
parentFix adb shell in 7.0 tree (diff)
downloadandroid_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar.gz
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar.bz2
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar.lz
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar.xz
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.tar.zst
android_bootable_recovery-3fdcda46629e8e7fc19e89c51350b1e6f151e05e.zip
Diffstat (limited to 'twrpTar.cpp')
-rw-r--r--twrpTar.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/twrpTar.cpp b/twrpTar.cpp
index 06e3b629a..3c07a97d1 100644
--- a/twrpTar.cpp
+++ b/twrpTar.cpp
@@ -71,6 +71,7 @@ twrpTar::twrpTar(void) {
tar_type.readfunc = read;
input_fd = -1;
output_fd = -1;
+ backup_exclusions = NULL;
}
twrpTar::~twrpTar(void) {
@@ -108,12 +109,18 @@ int twrpTar::createTarFork(pid_t *tar_fork_pid) {
char cmd[512];
file_count = 0;
+ if (backup_exclusions == NULL) {
+ LOGINFO("backup_exclusions is NULL\n");
+ return -1;
+ }
+#ifndef BUILD_TWRPTAR_MAIN
if (part_settings->adbbackup) {
std::string Backup_FileName(tarfn);
if (!twadbbu::Write_TWFN(Backup_FileName, Total_Backup_Size, use_compression))
return -1;
}
+#endif
if (pipe(progress_pipe) < 0) {
LOGINFO("Error creating progress tracking pipe\n");
@@ -168,7 +175,7 @@ int twrpTar::createTarFork(pid_t *tar_fork_pid) {
while ((de = readdir(d)) != NULL) {
FileName = tardir + "/" + de->d_name;
- if (de->d_type == DT_BLK || de->d_type == DT_CHR || du.check_skip_dirs(FileName))
+ if (de->d_type == DT_BLK || de->d_type == DT_CHR || backup_exclusions->check_skip_dirs(FileName))
continue;
if (de->d_type == DT_DIR) {
item_len = strlen(de->d_name);
@@ -183,9 +190,9 @@ int twrpTar::createTarFork(pid_t *tar_fork_pid) {
_exit(-1);
}
file_count = (unsigned long long)(ret);
- regular_size += du.Get_Folder_Size(FileName);
+ regular_size += backup_exclusions->Get_Folder_Size(FileName);
} else {
- encrypt_size += du.Get_Folder_Size(FileName);
+ encrypt_size += backup_exclusions->Get_Folder_Size(FileName);
}
} else if (de->d_type == DT_REG) {
stat(FileName.c_str(), &st);
@@ -216,7 +223,7 @@ int twrpTar::createTarFork(pid_t *tar_fork_pid) {
while ((de = readdir(d)) != NULL) {
FileName = tardir + "/" + de->d_name;
- if (de->d_type == DT_BLK || de->d_type == DT_CHR || du.check_skip_dirs(FileName))
+ if (de->d_type == DT_BLK || de->d_type == DT_CHR || backup_exclusions->check_skip_dirs(FileName))
continue;
if (de->d_type == DT_DIR) {
item_len = strlen(de->d_name);
@@ -657,7 +664,7 @@ int twrpTar::Generate_TarList(string Path, std::vector<TarListStruct> *TarList,
while ((de = readdir(d)) != NULL) {
FileName = Path + "/" + de->d_name;
- if (de->d_type == DT_BLK || de->d_type == DT_CHR || du.check_skip_dirs(FileName))
+ if (de->d_type == DT_BLK || de->d_type == DT_CHR || backup_exclusions->check_skip_dirs(FileName))
continue;
TarItem.fn = FileName;
TarItem.thread_id = *thread_id;
@@ -698,10 +705,12 @@ int twrpTar::extractTar() {
gui_err("restore_error=Error during restore process.");
return -1;
}
+#ifndef BUILD_TWRPTAR_MAIN
if (part_settings->adbbackup) {
if (!twadbbu::Write_TWEOF())
return -1;
}
+#endif
return 0;
}
@@ -1404,8 +1413,10 @@ int twrpTar::closeTar() {
#endif
}
else {
+#ifndef BUILD_TWRPTAR_MAIN
if (!twadbbu::Write_TWEOF())
return -1;
+#endif
}
if (input_fd >= 0)
close(input_fd);