[libcamera-devel] [RFC 1/2] libcamera: IPCPipeUnixSocket: Check that insertion succeeds
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Feb 9 00:47:32 CET 2021
Make sure the insertion succeeds. This was found by compile tests
with gcc7 which points out 'success' is not used.
../../src/libcamera/ipc_pipe_unixsocket.cpp:119:27: error: unused variable ‘success’ [-Werror=unused-variable]
const auto [iter, success] = callData_.insert({ cookie, { response, false } });
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
src/libcamera/ipc_pipe_unixsocket.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp
index 2bdce29e24d9acd1..cdb7eae0653384eb 100644
--- a/src/libcamera/ipc_pipe_unixsocket.cpp
+++ b/src/libcamera/ipc_pipe_unixsocket.cpp
@@ -118,6 +118,11 @@ int IPCPipeUnixSocket::call(const IPCUnixSocket::Payload &message,
const auto [iter, success] = callData_.insert({ cookie, { response, false } });
+ if (!success) {
+ LOG(IPCPipe, Error) << "Failed to insert call data";
+ return -EINVAL;
+ }
+
ret = socket_->send(message);
if (ret) {
callData_.erase(iter);
--
2.30.0
More information about the libcamera-devel
mailing list