summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-30 19:15:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-30 19:15:08 +0000
commit2d091f6bcdf5b80621ac8b820c309c286b97deec (patch)
treef2958f42f2c5cf45655426b281af8013de81cb1e
parentFix up warnings from latest clang-tidy (diff)
downloadlibdbpp-2d091f6bcdf5b80621ac8b820c309c286b97deec.tar.bz2
libdbpp-2d091f6bcdf5b80621ac8b820c309c286b97deec.tar.xz
libdbpp-2d091f6bcdf5b80621ac8b820c309c286b97deec.zip
Get error status from ferror
-rw-r--r--libdbpp/connection.cpp4
1 files 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<int>(-r), std::system_category());
+ if (const auto err = ferror(in)) {
+ throw std::system_error(err, std::system_category());
}
return total;
}