diff options
| author | Elliott Hughes <enh@google.com> | 2019-03-08 12:42:57 -0800 |
|---|---|---|
| committer | Elliott Hughes <enh@google.com> | 2019-03-08 12:42:57 -0800 |
| commit | 4db4add8da8dd9fd310b3832e3a3a927bb706de5 (patch) | |
| tree | 506bcc1df07f5dddb200004ec443313e45f4f175 /wifi | |
| parent | ace1da7c5bbc97102651e04f658d920f042d3255 (diff) | |
| download | android_hardware_interfaces-4db4add8da8dd9fd310b3832e3a3a927bb706de5.tar.gz android_hardware_interfaces-4db4add8da8dd9fd310b3832e3a3a927bb706de5.tar.bz2 android_hardware_interfaces-4db4add8da8dd9fd310b3832e3a3a927bb706de5.zip | |
wifi: use PLOG rather than LOG strerror.
Test: builds
Change-Id: I1a508dbb47fed3a1c1e5166b9b32d33ed0d246fe
Diffstat (limited to 'wifi')
| -rw-r--r-- | wifi/1.2/default/wifi_chip.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/wifi/1.2/default/wifi_chip.cpp b/wifi/1.2/default/wifi_chip.cpp index 3bd05570f..8c2d3cb72 100644 --- a/wifi/1.2/default/wifi_chip.cpp +++ b/wifi/1.2/default/wifi_chip.cpp @@ -113,7 +113,7 @@ bool removeOldFilesInternal() { const time_t delete_files_before = now - kMaxRingBufferFileAgeSeconds; DIR* dir_dump = opendir(kTombstoneFolderPath); if (!dir_dump) { - LOG(ERROR) << "Failed to open directory: " << strerror(errno); + PLOG(ERROR) << "Failed to open directory"; return false; } unique_fd dir_auto_closer(dirfd(dir_dump)); @@ -128,8 +128,7 @@ bool removeOldFilesInternal() { struct stat cur_file_stat; std::string cur_file_path = kTombstoneFolderPath + cur_file_name; if (stat(cur_file_path.c_str(), &cur_file_stat) == -1) { - LOG(ERROR) << "Failed to get file stat for " << cur_file_path - << ": " << strerror(errno); + PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; success = false; continue; } @@ -144,7 +143,7 @@ bool removeOldFilesInternal() { if (cur_file_count > kMaxRingBufferFileNum || cur_file.first < delete_files_before) { if (unlink(cur_file.second.c_str()) != 0) { - LOG(ERROR) << "Error deleting file " << strerror(errno); + PLOG(ERROR) << "Error deleting file"; success = false; } cur_file_count--; @@ -168,13 +167,11 @@ bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, major(st.st_dev), minor(st.st_dev), major(st.st_rdev), minor(st.st_rdev), static_cast<uint32_t>(file_name_len), 0); if (write(out_fd, read_buf.data(), llen) == -1) { - LOG(ERROR) << "Error writing cpio header to file " << file_name << " " - << strerror(errno); + PLOG(ERROR) << "Error writing cpio header to file " << file_name; return false; } if (write(out_fd, file_name, file_name_len) == -1) { - LOG(ERROR) << "Error writing filename to file " << file_name << " " - << strerror(errno); + PLOG(ERROR) << "Error writing filename to file " << file_name; return false; } @@ -183,8 +180,7 @@ bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, if (llen != 0) { const uint32_t zero = 0; if (write(out_fd, &zero, 4 - llen) == -1) { - LOG(ERROR) << "Error padding 0s to file " << file_name << " " - << strerror(errno); + PLOG(ERROR) << "Error padding 0s to file " << file_name; return false; } } @@ -200,17 +196,17 @@ size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { while (llen > 0) { ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); if (bytes_read == -1) { - LOG(ERROR) << "Error reading file " << strerror(errno); + PLOG(ERROR) << "Error reading file"; return ++n_error; } llen -= bytes_read; if (write(out_fd, read_buf.data(), bytes_read) == -1) { - LOG(ERROR) << "Error writing data to file " << strerror(errno); + PLOG(ERROR) << "Error writing data to file"; return ++n_error; } if (bytes_read == 0) { // this should never happen, but just in case // to unstuck from while loop - LOG(ERROR) << "Unexpected read result for " << strerror(errno); + PLOG(ERROR) << "Unexpected read result"; n_error++; break; } @@ -219,7 +215,7 @@ size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { if (llen != 0) { const uint32_t zero = 0; if (write(out_fd, &zero, 4 - llen) == -1) { - LOG(ERROR) << "Error padding 0s to file " << strerror(errno); + PLOG(ERROR) << "Error padding 0s to file"; return ++n_error; } } @@ -234,7 +230,7 @@ bool cpioWriteFileTrailer(int out_fd) { sprintf(read_buf.data(), "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0) + 4) == -1) { - LOG(ERROR) << "Error writing trailing bytes " << strerror(errno); + PLOG(ERROR) << "Error writing trailing bytes"; return false; } return true; @@ -248,7 +244,7 @@ size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { size_t n_error = 0; DIR* dir_dump = opendir(input_dir); if (!dir_dump) { - LOG(ERROR) << "Failed to open directory: " << strerror(errno); + PLOG(ERROR) << "Failed to open directory"; return ++n_error; } unique_fd dir_auto_closer(dirfd(dir_dump)); @@ -263,15 +259,13 @@ size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { struct stat st; const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; if (stat(cur_file_path.c_str(), &st) == -1) { - LOG(ERROR) << "Failed to get file stat for " << cur_file_path - << ": " << strerror(errno); + PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; n_error++; continue; } const int fd_read = open(cur_file_path.c_str(), O_RDONLY); if (fd_read == -1) { - LOG(ERROR) << "Failed to open file " << cur_file_path << " " - << strerror(errno); + PLOG(ERROR) << "Failed to open file " << cur_file_path; n_error++; continue; } @@ -1400,14 +1394,14 @@ bool WifiChip::writeRingbufferFilesInternal() { kTombstoneFolderPath + item.first + "XXXXXXXXXX"; const int dump_fd = mkstemp(makeCharVec(file_path_raw).data()); if (dump_fd == -1) { - LOG(ERROR) << "create file failed: " << strerror(errno); + PLOG(ERROR) << "create file failed"; return false; } unique_fd file_auto_closer(dump_fd); for (const auto& cur_block : cur_buffer.getData()) { if (write(dump_fd, cur_block.data(), sizeof(cur_block[0]) * cur_block.size()) == -1) { - LOG(ERROR) << "Error writing to file " << strerror(errno); + PLOG(ERROR) << "Error writing to file"; } } } |
