From afe358a2d0aef7b4f312f07db83f5af3424358e9 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 12 Sep 2024 16:22:58 +0200 Subject: Prefer fseek ofer rewind --- src/other_tools/utils/curl_easy_handle.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/other_tools/utils/curl_easy_handle.cpp') 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 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(size), '\0'); -- cgit v1.2.3