From 5b5949092847307f60293b50ed5388f265568581 Mon Sep 17 00:00:00 2001 From: Leah Rowe 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 --- 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 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':