summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsemarie <semarie@openbsd.org>2021-03-21 11:29:38 +0000
committersemarie <semarie@openbsd.org>2021-03-21 11:29:38 +0000
commitc49c61c6189f292e7cc497671b99c396a5890d71 (patch)
treed27022a0edcb7865fce2f9f94480827312d90455
parentUse uppercases for defines. (diff)
downloadwireguard-openbsd-c49c61c6189f292e7cc497671b99c396a5890d71.tar.xz
wireguard-openbsd-c49c61c6189f292e7cc497671b99c396a5890d71.zip
makes `struct execsw' to:
- use C99-style initialization (grep works better with that) - use const as execsw is not modified during runtime ok mpi@
-rw-r--r--sys/kern/exec_conf.c14
-rw-r--r--sys/sys/exec.h4
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/exec_conf.c b/sys/kern/exec_conf.c
index 43b0ebb9c12..e35e229e0d4 100644
--- a/sys/kern/exec_conf.c
+++ b/sys/kern/exec_conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_conf.c,v 1.36 2019/11/28 04:34:50 guenther Exp $ */
+/* $OpenBSD: exec_conf.c,v 1.37 2021/03/21 11:29:38 semarie Exp $ */
/* $NetBSD: exec_conf.c,v 1.16 1995/12/09 05:34:47 cgd Exp $ */
/*
@@ -38,9 +38,15 @@
extern struct emul emul_native;
-struct execsw execsw[] = {
- { EXEC_SCRIPT_HDRSZ, exec_script_makecmds }, /* shell scripts */
- { sizeof(Elf_Ehdr), exec_elf_makecmds }, /* elf binaries */
+const struct execsw execsw[] = {
+ { /* shell scripts */
+ .es_hdrsz = EXEC_SCRIPT_HDRSZ,
+ .es_check = exec_script_makecmds,
+ },
+ { /* elf binaries */
+ .es_hdrsz = sizeof(Elf_Ehdr),
+ .es_check = exec_elf_makecmds,
+ },
};
int nexecs = (sizeof execsw / sizeof(*execsw));
int exec_maxhdrsz;
diff --git a/sys/sys/exec.h b/sys/sys/exec.h
index 5158eb25e5c..a726202ebc6 100644
--- a/sys/sys/exec.h
+++ b/sys/sys/exec.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.h,v 1.42 2020/06/28 09:29:57 kettenis Exp $ */
+/* $OpenBSD: exec.h,v 1.43 2021/03/21 11:29:38 semarie Exp $ */
/* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */
/*-
@@ -212,7 +212,7 @@ void new_vmcmd(struct exec_vmcmd_set *evsp,
* Functions for specific exec types should be defined in their own
* header file.
*/
-extern struct execsw execsw[];
+extern const struct execsw execsw[];
extern int nexecs;
extern int exec_maxhdrsz;