summaryrefslogtreecommitdiff
path: root/util/spkmodem_recv/spkmodem-recv.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-16 15:09:33 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-16 23:11:35 +0100
commit5b5949092847307f60293b50ed5388f265568581 (patch)
tree7dbecf1e4ed4d64a37e612513725cc81ff04017f /util/spkmodem_recv/spkmodem-recv.c
parent25241ae22242eb7d178f4a76f2761987a5022d36 (diff)
util/spkmodem_recv: Use pledge but only on OpenBSD
It will only be used on OpenBSD. Other operating systems will behave in the same way. Pledge is feature specific to OpenBSD that restricts system operations, for security: https://man.openbsd.org/pledge.2 Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/spkmodem_recv/spkmodem-recv.c')
-rw-r--r--util/spkmodem_recv/spkmodem-recv.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c
index efc690ba..30e13d8a 100644
--- a/util/spkmodem_recv/spkmodem-recv.c
+++ b/util/spkmodem_recv/spkmodem-recv.c
@@ -36,6 +36,11 @@ main(int argc, char *argv[])
{
int c;
+#ifdef HAVE_PLEDGE
+ if (pledge("stdio", NULL) == -1)
+ err(errno, "pledge");
+#endif
+
while ((c = getopt(argc, argv, "u")) != -1) {
switch (c) {
case 'u':