[File] Compile error with seccomp disabled, landlock enabled

Christoph Biedl astron.com.bwoj at manchmal.in-ulm.de
Thu May 14 13:57:35 EDT 2026


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?


More information about the File mailing list