From ae1a5c6c2b82918850cb7b851e2f7dff33a40c57 Mon Sep 17 00:00:00 2001 From: Naios Date: Sat, 20 Feb 2016 20:18:42 +0100 Subject: Core/Updater: Use a different method for file reading * Current method causes issues under CentOS 6 and could possibly lead to cutted buffer content when reading in textmode. * Closes #16209 --- src/server/database/Updater/UpdateFetcher.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/server/database/Updater/UpdateFetcher.cpp') diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index fd0dbdd4b5a..001fdf20610 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -142,14 +142,12 @@ UpdateFetcher::SQLUpdate UpdateFetcher::ReadSQLUpdate(boost::filesystem::path co std::ifstream in(file.c_str()); WPFatal(in.is_open(), "Could not read an update file."); - auto const start_pos = in.tellg(); - in.ignore(std::numeric_limits::max()); - auto const char_count = in.gcount(); - in.seekg(start_pos); + auto update = [&in] { + std::ostringstream ss; + ss << in.rdbuf(); + return Trinity::make_unique(ss.str()); + }(); - SQLUpdate const update(new std::string(char_count, char{})); - - in.read(&(*update)[0], update->size()); in.close(); return update; } -- cgit v1.2.3