partitionmanager: Only create logical partition symlink when it doesn't exist

Legacy devices might have symlinks to real partitions in this folder.


Change-Id: I4d3360ff1022eabbd4f6ae7688d8bb7306ae9777
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 5772904..dd8470b 100755
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -3412,8 +3412,10 @@
 	twrpPart->Update_Size(true);
 	twrpPart->Set_Can_Be_Backed_Up(false);
 	twrpPart->Set_Can_Be_Wiped(false);
-	LOGINFO("Symlinking %s => /dev/block/bootdevice/by-name/%s \n", fstabEntry.blk_device.c_str(), bare_partition_name.c_str());
-	symlink(fstabEntry.blk_device.c_str(), ("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str());
+	if (access(("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str(), F_OK) == -1) {
+		LOGINFO("Symlinking %s => /dev/block/bootdevice/by-name/%s \n", fstabEntry.blk_device.c_str(), bare_partition_name.c_str());
+		symlink(fstabEntry.blk_device.c_str(), ("/dev/block/bootdevice/by-name/" + bare_partition_name).c_str());
+	}
 
     return true;
 }