diff options
author | Alberto Sartori <alberto.sartori86@gmail.com> | 2023-03-23 10:49:03 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-03-23 12:11:57 +0100 |
commit | 6a20550a83b0397696cbcecea73aa450d1385d75 (patch) | |
tree | 349a44b653dbc1bce6fffd9945569418c1948f03 /src | |
parent | d6eb885a3f205e00a3be9f2ae2e8f510cae15d8a (diff) | |
download | justbuild-6a20550a83b0397696cbcecea73aa450d1385d75.tar.gz |
curl_easy_handle: fix unused return value...
...depending on the compiler and/or c++lib version, std::fread may
warn about unused return value triggering a compile error, due to our
compile flags.
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/utils/curl_easy_handle.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/other_tools/utils/curl_easy_handle.cpp b/src/other_tools/utils/curl_easy_handle.cpp index 837a9ad0..17ba0261 100644 --- a/src/other_tools/utils/curl_easy_handle.cpp +++ b/src/other_tools/utils/curl_easy_handle.cpp @@ -41,7 +41,14 @@ auto read_stream_data(gsl::not_null<std::FILE*> const& stream) noexcept std::string content(static_cast<size_t>(size), '\0'); // read stream content into string buffer - std::fread(content.data(), 1, content.size(), stream); + auto n = std::fread(content.data(), 1, content.size(), stream); + if (n != static_cast<size_t>(size)) { + Logger::Log(LogLevel::Warning, + "Reading curl log from temporary file failed: read only {} " + "bytes while {} were expected", + n, + size); + } return content; } |