Message ID | 20250317181134.214074-1-barnabas.pocze@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
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@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@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 >
Quoting Barnabás Pőcze (2025-03-17 18:11:34) > 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@ideasonboard.com> I didn't know about std::ignore. Looks appropriate here... Reviewed-by: Kieran Bingham <kieran.bingham@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 >
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); } /**
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@ideasonboard.com> --- src/libcamera/media_device.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)