From 91436688874a2450c7da22527c59e34c2053b9ef Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Thu, 10 Jun 2021 16:50:25 +0900 Subject: libcamera: ipc_unixsocket: Use UniqueFD for a file descriptor IPCUnixSocket::create() creates two file descriptors. One of them is stored in IPCUnixSocket and the other is returned to a caller. This clarifies the ownership using UniqueFD. Signed-off-by: Hirokazu Honda Signed-off-by: Laurent Pinchart Reviewed-by: Hirokazu Honda Reviewed-by: Jacopo Mondi --- include/libcamera/internal/ipc_unixsocket.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/internal/ipc_unixsocket.h b/include/libcamera/internal/ipc_unixsocket.h index 5010b66a..3963d182 100644 --- a/include/libcamera/internal/ipc_unixsocket.h +++ b/include/libcamera/internal/ipc_unixsocket.h @@ -12,6 +12,7 @@ #include #include +#include namespace libcamera { @@ -28,8 +29,8 @@ public: IPCUnixSocket(); ~IPCUnixSocket(); - int create(); - int bind(int fd); + UniqueFD create(); + int bind(UniqueFD fd); void close(); bool isBound() const; @@ -49,7 +50,7 @@ private: void dataNotifier(); - int fd_; + UniqueFD fd_; bool headerReceived_; struct Header header_; EventNotifier *notifier_; -- cgit v1.2.1