[File] Compile error with seccomp disabled, landlock enabled
Christos Zoulas
christos at zoulas.com
Thu May 14 14:54:49 EDT 2026
On 2026-05-14 1:57 pm, Christoph Biedl wrote:
> Hello,
>
> my test builds of file are done with seccomp disabled, for reasons I
> forgot, so
>
> ./configure --disable-libseccomp
>
> Since the introduction of landlock support a few commits ago, this
> fails
> with:
>
> ```
> file.c:371:13: error: ‘sandbox’ undeclared (first use in this function)
> 371 | if (sandbox && enable_landlock(flags, action) == -1)
> | ^~~~~~~
> ```
>
> Now I'm not sure about the proper way to address this but at least this
> change made the compile pass again:
>
> ```
> --- a/src/file.c
> +++ b/src/file.c
> @@ -199,7 +199,7 @@ main(int argc, char *argv[])
> size_t i, j, wid, nw;
> int action = 0, didsomefiles = 0, errflg = 0;
> int flags = 0, e = 0;
> -#ifdef HAVE_LIBSECCOMP
> +#if defined(HAVE_LIBSECCOMP) || defined(HAVE_LINUX_LANDLOCK_H)
> int sandbox = 1;
> #endif
> struct magic_set *magic = NULL;
> ```
>
> Thoughts?
Fixed, thanks!
christos
More information about the File
mailing list