summaryrefslogtreecommitdiffstats
path: root/otautil/logging.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-07-25 02:57:11 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-07-25 02:57:11 +0200
commit984dc5c263ce2fed05dc466000201f74c98a8b34 (patch)
treecdc61aedfc4d532bc59e94b8470d3fafbb43c917 /otautil/logging.cpp
parentMerge "Add command line parser for simulator" am: 7965a95adc am: 94bc9e1010 (diff)
parentMerge "Clean up some global variables in common.h" am: 80c405f692 (diff)
downloadandroid_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar.gz
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar.bz2
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar.lz
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar.xz
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.tar.zst
android_bootable_recovery-984dc5c263ce2fed05dc466000201f74c98a8b34.zip
Diffstat (limited to 'otautil/logging.cpp')
-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;
}