From ff2b7881c96c81d510481b92982d099e9101dbec Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Sat, 10 Dec 2016 09:04:41 -0600 Subject: Change handling of /cache due to AB devices not having cache Change-Id: Ia9b97ed19eb3d400d9d399255108cac79361bca4 --- twrp-functions.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 72674ae69..9b0356ff8 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -498,8 +498,14 @@ void TWFunc::Update_Log_File(void) { chown("/cache/recovery/log", 1000, 1000); chmod("/cache/recovery/log", 0600); chmod("/cache/recovery/last_log", 0640); + } else if (PartitionManager.Mount_By_Path("/data", false) && TWFunc::Path_Exists("/data/cache/recovery/.")) { + Copy_Log(TMP_LOG_FILE, "/data/cache/recovery/log"); + copy_file("/data/cache/recovery/log", "/data/cache/recovery/last_log", 600); + chown("/data/cache/recovery/log", 1000, 1000); + chmod("/data/cache/recovery/log", 0600); + chmod("/data/cache/recovery/last_log", 0640); } else { - LOGINFO("Failed to mount /cache for TWFunc::Update_Log_File\n"); + LOGINFO("Failed to mount /cache or find /data/cache for TWFunc::Update_Log_File\n"); } // Reset bootloader message @@ -515,7 +521,7 @@ void TWFunc::Update_Log_File(void) { } } - if (PartitionManager.Mount_By_Path("/cache", true)) { + if (PartitionManager.Mount_By_Path("/cache", false)) { if (unlink("/cache/recovery/command") && errno != ENOENT) { LOGINFO("Can't unlink %s\n", "/cache/recovery/command"); } -- cgit v1.2.3