[libcamera-devel,v4,4/6] py: Set EFD_CLOEXEC on eventfd to avoid fd leaking
diff mbox series

Message ID 20220819111615.39814-5-tomi.valkeinen@ideasonboard.com
State Accepted
Commit dfa86000a63f8d94399a28e5432e445239526389
Headers show
Series
  • Python bindings: PyCameraManager and non-blocking eventfd
Related show

Commit Message

Tomi Valkeinen Aug. 19, 2022, 11:16 a.m. UTC
Set EFD_CLOEXEC on eventfd to avoid fd leaking.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/py/libcamera/py_camera_manager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp
index 18fdb623..8bfb8e57 100644
--- a/src/py/libcamera/py_camera_manager.cpp
+++ b/src/py/libcamera/py_camera_manager.cpp
@@ -24,7 +24,7 @@  PyCameraManager::PyCameraManager()
 
 	cameraManager_ = std::make_unique<CameraManager>();
 
-	int fd = eventfd(0, 0);
+	int fd = eventfd(0, EFD_CLOEXEC);
 	if (fd == -1)
 		throw std::system_error(errno, std::generic_category(),
 					"Failed to create eventfd");