summaryrefslogtreecommitdiffstats
path: root/otautil/logging.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-05-15 22:59:39 +0200
committerTianjie Xu <xunchang@google.com>2019-07-24 20:36:03 +0200
commit164c60a4f3de934bab7035114546e9500cd8f232 (patch)
tree0311dd6f33655ae9b5f1aec1847405bcd54673fb /otautil/logging.cpp
parentMerge "Add command line parser for simulator" (diff)
downloadandroid_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar.gz
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar.bz2
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar.lz
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar.xz
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.tar.zst
android_bootable_recovery-164c60a4f3de934bab7035114546e9500cd8f232.zip
Diffstat (limited to '')
-rw-r--r--otautil/logging.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/otautil/logging.cpp b/otautil/logging.cpp
index 484f1150f..3db0e8ac2 100644
--- a/otautil/logging.cpp
+++ b/otautil/logging.cpp
@@ -178,9 +178,8 @@ void reset_tmplog_offset() {
tmplog_offset = 0;
}
-static void copy_log_file(const std::string& source, const std::string& destination, bool append,
- const selabel_handle* sehandle) {
- FILE* dest_fp = fopen_path(destination, append ? "ae" : "we", sehandle);
+static void copy_log_file(const std::string& source, const std::string& destination, bool append) {
+ FILE* dest_fp = fopen_path(destination, append ? "ae" : "we", logging_sehandle);
if (dest_fp == nullptr) {
PLOG(ERROR) << "Can't open " << destination;
} else {
@@ -203,7 +202,7 @@ static void copy_log_file(const std::string& source, const std::string& destinat
}
}
-void copy_logs(bool save_current_log, bool has_cache, const selabel_handle* sehandle) {
+void copy_logs(bool save_current_log) {
// We only rotate and record the log of the current session if explicitly requested. This usually
// happens after wipes, installation from BCB or menu selections. This is to avoid unnecessary
// rotation (and possible deletion) of log files, if it does not do anything loggable.
@@ -216,7 +215,7 @@ void copy_logs(bool save_current_log, bool has_cache, const selabel_handle* seha
copy_log_file_to_pmsg(Paths::Get().temporary_install_file(), LAST_INSTALL_FILE);
// We can do nothing for now if there's no /cache partition.
- if (!has_cache) {
+ if (!HasCache()) {
return;
}
@@ -225,9 +224,9 @@ void copy_logs(bool save_current_log, bool has_cache, const selabel_handle* seha
rotate_logs(LAST_LOG_FILE, LAST_KMSG_FILE);
// Copy logs to cache so the system can find out what happened.
- copy_log_file(Paths::Get().temporary_log_file(), LOG_FILE, true, sehandle);
- copy_log_file(Paths::Get().temporary_log_file(), LAST_LOG_FILE, false, sehandle);
- copy_log_file(Paths::Get().temporary_install_file(), LAST_INSTALL_FILE, false, sehandle);
+ copy_log_file(Paths::Get().temporary_log_file(), LOG_FILE, true);
+ copy_log_file(Paths::Get().temporary_log_file(), LAST_LOG_FILE, false);
+ copy_log_file(Paths::Get().temporary_install_file(), LAST_INSTALL_FILE, false);
save_kernel_log(LAST_KMSG_FILE);
chmod(LOG_FILE, 0600);
chown(LOG_FILE, AID_SYSTEM, AID_SYSTEM);
@@ -319,7 +318,7 @@ bool RestoreLogFilesAfterFormat(const std::vector<saved_log_file>& log_files) {
// Reset the pointer so we copy from the beginning of the temp
// log.
reset_tmplog_offset();
- copy_logs(true /* save_current_log */, true /* has_cache */, logging_sehandle);
+ copy_logs(true /* save_current_log */);
return true;
}