aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-10-16 22:45:44 -0400
committerMike Frysinger <vapier@gentoo.org>2021-10-16 22:45:44 -0400
commitacc9835d8c96451f88b65822f1f6b5b4f27594e0 (patch)
tree90eadb3a8e17e86ef19b4ed29bbcdfc70f3c5ec2
parentswitch back to my action name (diff)
downloadpax-utils-acc9835d8c96451f88b65822f1f6b5b4f27594e0.tar.gz
pax-utils-acc9835d8c96451f88b65822f1f6b5b4f27594e0.tar.bz2
pax-utils-acc9835d8c96451f88b65822f1f6b5b4f27594e0.zip
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@gentoo.org>
-rw-r--r--seccomp-bpf.c6
1 files 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),