From 71e5aa4eeef3aeab127fa1fd302bf66eedf19acb Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Tue, 26 Feb 2013 20:10:16 -0500 Subject: fix restore on mknod Change-Id: I9fb8b927f81a8cded651e42026beb3d5c252d1e8 --- libtar/extract.c | 16 ++++++++-------- twrpTar.cpp | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libtar/extract.c b/libtar/extract.c index 554428715..8860e5047 100644 --- a/libtar/extract.c +++ b/libtar/extract.c @@ -95,7 +95,7 @@ tar_extract_file(TAR *t, char *realname) char *lnp; int pathname_len; int realname_len; - + if (t->options & TAR_NOOVERWRITE) { struct stat s; @@ -139,13 +139,13 @@ tar_extract_file(TAR *t, char *realname) } if (i != 0) { - printf("here i: %d\n", i); + printf("FAILED RESTORE OF FILE i: %s\n", realname); return i; } i = tar_set_file_perms(t, realname); if (i != 0) { - printf("i: %d\n", i); + printf("FAILED SETTING PERMS: %d\n", i); return i; } /* @@ -346,7 +346,7 @@ int tar_extract_symlink(TAR *t, char *realname) { char *filename; - + if (!TH_ISSYM(t)) { printf("not a sym\n"); @@ -412,9 +412,9 @@ tar_extract_chardev(TAR *t, char *realname) compat_makedev(devmaj, devmin)) == -1) { #ifdef DEBUG - perror("mknod()"); + printf("mknod() failed, returning good anyway"); #endif - return -1; + return 0; } return 0; @@ -451,9 +451,9 @@ tar_extract_blockdev(TAR *t, char *realname) compat_makedev(devmaj, devmin)) == -1) { #ifdef DEBUG - perror("mknod()"); + printf("mknod() failed but returning anyway"); #endif - return -1; + return 0; } return 0; diff --git a/twrpTar.cpp b/twrpTar.cpp index c4600aa4d..0bf76e519 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -133,7 +133,7 @@ int twrpTar::extractTarFork() { } else { if ((pid = wait(&status)) == -1) { - LOGI("Tar creation failed\n"); + LOGI("Tar extraction failed\n"); return -1; } else { @@ -142,7 +142,7 @@ int twrpTar::extractTarFork() { return -1; } else if (WIFEXITED(status) != 0) - LOGI("Tar creation successful\n"); + LOGI("Tar extraction successful\n"); else { LOGI("Tar creation failed\n"); return -1; @@ -210,6 +210,8 @@ int twrpTar::Generate_Multiple_Archives(string Path) { FileName += de->d_name; if (has_data_media == 1 && FileName.size() >= 11 && strncmp(FileName.c_str(), "/data/media", 11) == 0) continue; // Skip /data/media + if (de->d_type == DT_BLK || de->d_type == DT_CHR) + continue; if (de->d_type == DT_DIR && strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0) { unsigned long long folder_size = TWFunc::Get_Folder_Size(FileName, false); @@ -344,6 +346,8 @@ int twrpTar::tarDirs(bool include_root) { LOGI("adding %s\n", de->d_name); #ifdef RECOVERY_SDCARD_ON_DATA if ((tardir == "/data" || tardir == "/data/") && strcmp(de->d_name, "media") == 0) continue; + if (de->d_type == DT_BLK || de->d_type == DT_CHR) + continue; #endif if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue; -- cgit v1.2.3