From 2a384edf8af72b3e44964db0e1a859558de39196 Mon Sep 17 00:00:00 2001 From: mestre Date: Fri, 20 Jul 2018 21:47:07 +0000 Subject: [PATCH] add pledge(2), it only needs rpath if reading from a file hint from tb@ and OK ratchov@ --- usr.bin/midiplay/midiplay.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr.bin/midiplay/midiplay.c b/usr.bin/midiplay/midiplay.c index ab400fdfad8..4eb79515494 100644 --- a/usr.bin/midiplay/midiplay.c +++ b/usr.bin/midiplay/midiplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midiplay.c,v 1.20 2018/07/20 21:44:41 mestre Exp $ */ +/* $OpenBSD: midiplay.c,v 1.21 2018/07/20 21:47:07 mestre Exp $ */ /* $NetBSD: midiplay.c,v 1.8 1998/11/25 22:17:07 augustss Exp $ */ /* @@ -463,6 +463,14 @@ main(int argc, char **argv) if (setitimer(ITIMER_REAL, &it, NULL) < 0) err(1, "setitimer"); + if (example || argc == 0) { + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + } else { + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + } + if (example) playdata(sample, sizeof sample, ""); else if (argc == 0) -- 2.20.1