commit:     acc9835d8c96451f88b65822f1f6b5b4f27594e0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 17 02:45:44 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct 17 02:45:44 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=acc9835d

seccomp: mark arrays const+static

This generates better code, although it doesn't super matter since
this is only used at build time.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 seccomp-bpf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/seccomp-bpf.c b/seccomp-bpf.c
index 5279d20..6a095a4 100644
--- a/seccomp-bpf.c
+++ b/seccomp-bpf.c
@@ -49,7 +49,7 @@ static const struct {
 };
 
 /* Simple helper to add all of the syscalls in an array. */
-static int gen_seccomp_rules_add(scmp_filter_ctx ctx, int syscalls[], size_t 
num)
+static int gen_seccomp_rules_add(scmp_filter_ctx ctx, const int syscalls[], 
size_t num)
 {
        static uint8_t prio;
        size_t i;
@@ -102,7 +102,7 @@ static void gen_seccomp_program(const char *name)
 int main(void)
 {
        /* Order determines priority (first == lowest prio).  */
-       int base_syscalls[] = {
+       static const int base_syscalls[] = {
                /* We write the most w/scanelf.  */
                SCMP_SYS(write),
                SCMP_SYS(writev),
@@ -194,7 +194,7 @@ int main(void)
                /* glibc-2.34+ uses it as part of mem alloc functions. */
                SCMP_SYS(getrandom),
        };
-       int fork_syscalls[] = {
+       static const int fork_syscalls[] = {
                SCMP_SYS(clone),
                SCMP_SYS(execve),
                SCMP_SYS(fork),

Reply via email to