From b4553fb75eb869df223a9118fb0156fa1110bbf4 Mon Sep 17 00:00:00 2001 From: Leah Rowe <leah@libreboot.org> Date: Tue, 16 May 2023 15:09:33 +0100 Subject: [PATCH] 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> --- util/spkmodem_recv/spkmodem-recv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index efc690b..30e13d8 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': -- GitLab