From 2d091f6bcdf5b80621ac8b820c309c286b97deec Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 30 Jan 2022 19:15:08 +0000 Subject: Get error status from ferror --- libdbpp/connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp index 531b5bb..7d3db42 100644 --- a/libdbpp/connection.cpp +++ b/libdbpp/connection.cpp @@ -154,8 +154,8 @@ DB::Connection::bulkUploadData(FILE * in) const bulkUploadData(buf.data(), r); total += r; } - if (-r > 0) { - throw std::system_error(static_cast(-r), std::system_category()); + if (const auto err = ferror(in)) { + throw std::system_error(err, std::system_category()); } return total; } -- cgit v1.2.3