diff options
-rw-r--r-- | partitionmanager.cpp | 7 | ||||
-rw-r--r-- | twrpTar.cpp | 25 |
2 files changed, 19 insertions, 13 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp index d7f1600ef..dd2dfd2c4 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -865,7 +865,7 @@ int TWPartitionManager::Run_Restore(string Restore_Name) { } } } else { - LOGERR("Unable to locate '%s' partition for restoring.\n", restore_path.c_str()); + LOGERR("Unable to locate '%s' partition for restoring (restore list).\n", restore_path.c_str()); } start_pos = end_pos + 1; end_pos = Restore_List.find(";", start_pos); @@ -1814,9 +1814,10 @@ void TWPartitionManager::Get_Partition_List(string ListType, std::vector<Partiti size_t start_pos = 0, end_pos = Restore_List.find(";", start_pos); while (end_pos != string::npos && start_pos < Restore_List.size()) { restore_path = Restore_List.substr(start_pos, end_pos - start_pos); - if ((restore_part = Find_Partition_By_Path(restore_path)) != NULL && !restore_part->Is_SubPartition) { - if (restore_part->Backup_Name == "recovery") { + if ((restore_part = Find_Partition_By_Path(restore_path)) != NULL) { + if (restore_part->Backup_Name == "recovery" || restore_part->Is_SubPartition) { // Don't allow restore of recovery (causes problems on some devices) + // Don't add subpartitions to the list of items } else { struct PartitionList part; part.Display_Name = restore_part->Backup_Display_Name; 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; } |