summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--twrp.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/twrp.cpp b/twrp.cpp
index b7fc9815d..e34c9b381 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -333,16 +333,22 @@ int main(int argc, char **argv) {
#endif
// Check if system has never been changed
- if (DataManager::GetIntValue("tw_mount_system_ro") != 0 && DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
- TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
- if (sys && sys->Check_Lifetime_Writes() == 0) {
- LOGINFO("System writes is 0, show system_readonly page\n");
- DataManager::SetValue("tw_back", "main");
- if (gui_startPage("system_readonly", 1, 1) != 0) {
- LOGERR("Failed to start system_readonly GUI page.\n");
+ TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
+ if (sys) {
+ if (DataManager::GetIntValue("tw_mount_system_ro") != 0) {
+ if (sys->Check_Lifetime_Writes() == 0) {
+ if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
+ DataManager::SetValue("tw_back", "main");
+ if (gui_startPage("system_readonly", 1, 1) != 0) {
+ LOGERR("Failed to start system_readonly GUI page.\n");
+ }
+ }
+ } else {
+ DataManager::SetValue("tw_mount_system_ro", 0);
+ sys->Change_Mount_Read_Only(false);
}
} else {
- DataManager::SetValue("tw_mount_system_ro", 0);
+ sys->Change_Mount_Read_Only(false);
}
}