Skip to content

Commit

Permalink
Additional checks to prevent partitioning internal storage
Browse files Browse the repository at this point in the history
Change-Id: I9fcd7e0169fbdd52405c0c86aafbef091f69411e
  • Loading branch information
Dees-Troy committed Sep 15, 2014
1 parent e444918 commit 1eff6cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion partitionmanager.cpp
Expand Up @@ -1862,7 +1862,7 @@ int TWPartitionManager::Partition_SDCard(void) {
#else
TWPartition* SDCard = Find_Partition_By_Path("/sdcard");
#endif
if (SDCard == NULL) {
if (SDCard == NULL || !SDCard->Removable || SDCard->Has_Data_Media) {
LOGERR("Unable to locate device to partition.\n");
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion partitions.hpp
Expand Up @@ -74,6 +74,9 @@ class TWPartition
string MTD_Name; // Name of the partition for MTD devices
bool Is_Present; // Indicates if the partition is currently present as a block device

protected:
bool Has_Data_Media; // Indicates presence of /data/media, may affect wiping and backup methods

private:
bool Process_Fstab_Line(string Line, bool Display_Error); // Processes a fstab line
void Find_Actual_Block_Device(); // Determines the correct block device and stores it in Actual_Block_Device
Expand Down Expand Up @@ -147,7 +150,6 @@ class TWPartition
Backup_Method_enum Backup_Method; // Method used for backup
bool Can_Encrypt_Backup; // Indicates if this item can be encrypted during backup
bool Use_Userdata_Encryption; // Indicates if we will use userdata encryption splitting on an encrypted backup
bool Has_Data_Media; // Indicates presence of /data/media, may affect wiping and backup methods
bool Has_Android_Secure; // Indicates the presence of .android_secure on this partition
bool Is_Storage; // Indicates if this partition is used for storage for backup, restore, and installing zips
bool Is_Settings_Storage; // Indicates that this storage partition is the location of the .twrps settings file and the location that is used for custom themes
Expand Down

0 comments on commit 1eff6cd

Please sign in to comment.