From a95f55c3ef657411f92c0c00a2e23ceb1d52b851 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Sat, 17 Aug 2013 13:14:43 +0000 Subject: Add SELinux support Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed --- partition.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'partition.cpp') diff --git a/partition.cpp b/partition.cpp index f81748d72..dc71bb9a4 100644 --- a/partition.cpp +++ b/partition.cpp @@ -49,10 +49,15 @@ extern "C" { #ifdef TW_INCLUDE_CRYPTO_SAMSUNG #include "crypto/libcrypt_samsung/include/libcrypt_samsung.h" #endif +#ifdef USE_EXT4 + #include "make_ext4fs.h" +#endif } using namespace std; +extern struct selabel_handle *selinux_handle; + TWPartition::TWPartition(void) { Can_Be_Mounted = false; Can_Be_Wiped = false; @@ -1257,6 +1262,19 @@ bool TWPartition::Wipe_EXT4() { if (!UnMount(true)) return false; +#ifdef USE_EXT4 + gui_print("Formatting %s using make_ext4fs function.\n", Display_Name.c_str()); +#ifdef HAVE_SELINUX + if (make_ext4fs(Actual_Block_Device.c_str(), Length, Mount_Point.c_str(), selinux_handle) != 0) { +#else + if (make_ext4fs(Actual_Block_Device.c_str(), Length) != 0) { +#endif + LOGERR("Unable to wipe '%s' using function call.\n", Mount_Point.c_str()); + return false; + } else { + return true; + } +#else if (TWFunc::Path_Exists("/sbin/make_ext4fs")) { string Command, result; @@ -1283,7 +1301,7 @@ bool TWPartition::Wipe_EXT4() { } } else return Wipe_EXT23("ext4"); - +#endif return false; } -- cgit v1.2.3