diff options
author | Tianjie Xu <xunchang@google.com> | 2019-07-25 00:45:32 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-07-25 00:45:32 +0200 |
commit | 80c405f692f070a7cc1158c90b313d6b594aa3ab (patch) | |
tree | 0311dd6f33655ae9b5f1aec1847405bcd54673fb /otautil/logging.cpp | |
parent | Merge "Add command line parser for simulator" (diff) | |
parent | Clean up some global variables in common.h (diff) | |
download | android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar.gz android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar.bz2 android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar.lz android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar.xz android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.tar.zst android_bootable_recovery-80c405f692f070a7cc1158c90b313d6b594aa3ab.zip |
Diffstat (limited to 'otautil/logging.cpp')
-rw-r--r-- | otautil/logging.cpp | 17 |
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; } |