[libcamera-devel] [PATCH v7 09/10] libcamera: IPCPipeUnixSocket: Check that insertion succeeds
Paul Elder
paul.elder at ideasonboard.com
Thu Feb 11 08:18:04 CET 2021
From: Niklas Söderlund <niklas.soderlund at ragnatech.se>
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>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
---
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 2bdce29e..cdb7eae0 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.27.0
More information about the libcamera-devel
mailing list