diff options
author | Elliott Hughes <enh@google.com> | 2019-03-12 08:11:39 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-12 08:11:39 -0700 |
commit | 14c495fc88dad2b07b31d0434b22aaeea9478af0 (patch) | |
tree | 7c9f1778f780872b7a0cb399c036d49355deb1c6 /wifi/1.3 | |
parent | 8780306ce3ce25ea4d89ec8a6c2688c55cfcb2b1 (diff) | |
parent | 9034bf375d429b1f5a59046be0338dcc79281ccc (diff) | |
download | android_hardware_interfaces-14c495fc88dad2b07b31d0434b22aaeea9478af0.tar.gz android_hardware_interfaces-14c495fc88dad2b07b31d0434b22aaeea9478af0.tar.bz2 android_hardware_interfaces-14c495fc88dad2b07b31d0434b22aaeea9478af0.zip |
Merge "wifi: use PLOG rather than LOG strerror." am: fba8a08e6f am: 6d37b594a8
am: 9034bf375d
Change-Id: I483a457782a441e5b59f7b0b08e7a4cdf4f12949
Diffstat (limited to 'wifi/1.3')
-rw-r--r-- | wifi/1.3/default/wifi_chip.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp index 727aac534..d4c032915 100644 --- a/wifi/1.3/default/wifi_chip.cpp +++ b/wifi/1.3/default/wifi_chip.cpp @@ -114,7 +114,7 @@ bool removeOldFilesInternal() { std::unique_ptr<DIR, decltype(&closedir)> dir_dump( opendir(kTombstoneFolderPath), closedir); if (!dir_dump) { - LOG(ERROR) << "Failed to open directory: " << strerror(errno); + PLOG(ERROR) << "Failed to open directory"; return false; } struct dirent* dp; @@ -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; @@ -249,7 +245,7 @@ size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { std::unique_ptr<DIR, decltype(&closedir)> dir_dump(opendir(input_dir), closedir); if (!dir_dump) { - LOG(ERROR) << "Failed to open directory: " << strerror(errno); + PLOG(ERROR) << "Failed to open directory"; return ++n_error; } while ((dp = readdir(dir_dump.get()))) { @@ -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; } @@ -1373,14 +1367,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"; } } } |