From d0c24c50d9857254f5d32cf53adb0091ceaa1fa6 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Fri, 11 Oct 2013 20:28:00 -0400 Subject: fix getting and setting contexts in selinux recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3 --- twrpTar.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'twrpTar.cpp') diff --git a/twrpTar.cpp b/twrpTar.cpp index 9c151b939..534049f97 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -34,6 +34,7 @@ extern "C" { #include #include #include +#include #include #include "twrpTar.hpp" #include "twcommon.h" @@ -532,7 +533,7 @@ int twrpTar::Generate_Multiple_Archives(string Path) { 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 && strcmp(de->d_name, "lost+foud") != 0) + 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); if (Archive_Current_Size + folder_size > MAX_ARCHIVE_SIZE) { @@ -717,7 +718,11 @@ int twrpTar::tarDirs(bool include_root) { if (strcmp(de->d_name, ".") != 0) { subfolder += de->d_name; } else { - LOGINFO("addFile '%s' including root: %i\n", buf, include_root); + std::string parentDir = basename(subfolder.c_str()); + LOGINFO("parentDir: %s\n", parentDir.c_str()); + if (!parentDir.compare("lost+found")) + continue; + LOGINFO("tarDirs addFile '%s' including root: %i\n", subfolder.c_str(), include_root); if (addFile(subfolder, include_root) != 0) return -1; continue; -- cgit v1.2.3