Fix backup of datadata

Change-Id: Ib0098542599283787592ba08caa070dc818d6111
This commit is contained in:
Dees_Troy
2013-07-01 20:48:43 +00:00
committed by Dees_Troy
parent 76543db6e6
commit 59df9264e3
2 changed files with 19 additions and 13 deletions
+15 -10
View File
@@ -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;
}