[PATCH v1] libcamera: media_device: Ignore `lockf()` return value
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Mon Mar 17 19:51:33 CET 2025
Hi Barnabás
On Mon, Mar 17, 2025 at 07:11:34PM +0100, Barnabás Pőcze wrote:
> 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>
Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
Thanks
j
> ---
> 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