From a220bda05d2aa185a2fb9aa721928f139fe926a9 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 13 Jan 2017 14:38:00 +0100 Subject: [PATCH] check return value from std::fread --- include/mapnik/util/file_io.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/mapnik/util/file_io.hpp b/include/mapnik/util/file_io.hpp index bb496b3a2..00c925006 100644 --- a/include/mapnik/util/file_io.hpp +++ b/include/mapnik/util/file_io.hpp @@ -83,11 +83,8 @@ public: if (!size_) return nullptr; std::fseek(file_.get(), 0, SEEK_SET); data_type buffer(new char[size_]); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-result" - std::fread(buffer.get(), size_, 1, file_.get()); -#pragma GCC diagnostic pop + auto count = std::fread(buffer.get(), size_, 1, file_.get()); + if (count != 1) return nullptr; return buffer; } private: