Fix buffer_copy
boost::asio::buffer_copy returns an integer of the number of values
copied. Some static analysis tools mark that value as nodiscard,
although it should never fail. Audit all uses of buffer_copy, and make
sure that they're using the return value. In theory this should have
no change on the behavior.
Change-Id: I6af39b5347954c2932cf3d4e48e96ff9ae01583a
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 17d57b4..838e7a1 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -125,9 +125,9 @@
void send(std::string_view buffer, std::function<void()>&& onDone)
{
- boost::asio::buffer_copy(ws2uxBuf.prepare(buffer.size()),
- boost::asio::buffer(buffer));
- ws2uxBuf.commit(buffer.size());
+ size_t copied = boost::asio::buffer_copy(
+ ws2uxBuf.prepare(buffer.size()), boost::asio::buffer(buffer));
+ ws2uxBuf.commit(copied);
doWrite(std::move(onDone));
}