partitionmanager: Unmount all directories mounted to same block

 * Like Xiaomi's some older devices uses cust as vendor and also mounts cust & vendor simultanously

 * This patch will unmount all directories mounted to same block

Change-Id: Ic242e267a470b4d82098d847f74b807a461605c4
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
(cherry picked from commit 77a31917f2817d3f147dc6e727f52d537e11fe4d)
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 19c527f..1974224 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1284,6 +1284,7 @@
 
 int TWPartitionManager::Wipe_By_Path(string Path) {
 	std::vector<TWPartition*>::iterator iter;
+	std::vector < TWPartition * >::iterator iter1;
 	int ret = false;
 	bool found = false;
 	string Local_Path = TWFunc::Get_Root_Path(Path);
@@ -1291,6 +1292,14 @@
 	// Iterate through all partitions
 	for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
 		if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path)) {
+			// iterate through all partitions since some legacy devices uses other partitions as vendor causes issues while wiping
+			(*iter)->Find_Actual_Block_Device();
+			for (iter1 = Partitions.begin (); iter1 != Partitions.end (); iter1++)
+			{
+				(*iter1)->Find_Actual_Block_Device();
+				if ((*iter)->Actual_Block_Device == (*iter1)->Actual_Block_Device && (*iter)->Mount_Point != (*iter1)->Mount_Point)
+					(*iter1)->UnMount(false);
+			}
 			if (Path == "/and-sec")
 				ret = (*iter)->Wipe_AndSec();
 			else