[PATCH v1] libcamera: media_device: Ignore `lockf()` return value

Barnabás Pőcze barnabas.pocze at ideasonboard.com
Mon Mar 17 19:11:34 CET 2025


When `_FORTIFY_SOURCE` is enabled, the `lockf()` function might be marked
with the `warn_unused_result` attribute, leading to compilation failure.
Fix that by explicitly ignoring the return value.

Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
---
 src/libcamera/media_device.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index d71dad74d..75abd91d7 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -13,6 +13,7 @@
 #include <string>
 #include <string.h>
 #include <sys/ioctl.h>
+#include <tuple>
 #include <unistd.h>
 #include <vector>
 
@@ -164,7 +165,7 @@ void MediaDevice::unlock()
 	if (!fd_.isValid())
 		return;
 
-	lockf(fd_.get(), F_ULOCK, 0);
+	std::ignore = lockf(fd_.get(), F_ULOCK, 0);
 }
 
 /**
-- 
2.49.0



More information about the libcamera-devel mailing list