From edd70612e520f742600ce997f3b4ab0e0d9236c8 Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Thu, 10 Jun 2021 16:50:20 +0900 Subject: libcamera: file: Manage fd by UniqueFD Manages the file descriptor owned by File by UniqueFD. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Signed-off-by: Laurent Pinchart --- include/libcamera/base/file.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h index 55e8edd9..0cdc2ed0 100644 --- a/include/libcamera/base/file.h +++ b/include/libcamera/base/file.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace libcamera { @@ -48,7 +49,7 @@ public: bool exists() const; bool open(OpenMode mode); - bool isOpen() const { return fd_ != -1; } + bool isOpen() const { return fd_.isValid(); } OpenMode openMode() const { return mode_; } void close(); @@ -73,7 +74,7 @@ private: void unmapAll(); std::string name_; - int fd_; + UniqueFD fd_; OpenMode mode_; int error_; -- cgit v1.2.1