summaryrefslogtreecommitdiff
path: root/src/other_tools/utils
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-09-12 16:22:58 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-09-12 16:26:40 +0200
commitafe358a2d0aef7b4f312f07db83f5af3424358e9 (patch)
tree5151ee6a5c467ad896d3a7bb975df63ca68ce9f2 /src/other_tools/utils
parent30d25e78424e5163fb8e6890e23eb4fe3a0ddb94 (diff)
downloadjustbuild-afe358a2d0aef7b4f312f07db83f5af3424358e9.tar.gz
Prefer fseek ofer rewind
Diffstat (limited to 'src/other_tools/utils')
-rw-r--r--src/other_tools/utils/curl_easy_handle.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/other_tools/utils/curl_easy_handle.cpp b/src/other_tools/utils/curl_easy_handle.cpp
index 2fcfb877..43bdfced 100644
--- a/src/other_tools/utils/curl_easy_handle.cpp
+++ b/src/other_tools/utils/curl_easy_handle.cpp
@@ -37,7 +37,11 @@ auto read_stream_data(gsl::not_null<std::FILE*> const& stream) noexcept
// obtain stream size
std::fseek(stream, 0, SEEK_END);
auto size = std::ftell(stream);
- std::rewind(stream);
+ auto pos = std::fseek(stream, 0, SEEK_SET);
+ if (pos != 0) {
+ Logger::Log(LogLevel::Warning,
+ "Rewinding temporary file for curl log failed.");
+ }
// create string buffer to hold stream content
std::string content(static_cast<std::size_t>(size), '\0');