Commit Diff
Diff:
3fc7366684dd5a216deed3c8d7c69c1792022d5c
936bd53498d80451f2aeea9ab6295de8df9ab4fc
Commit:
936bd53498d80451f2aeea9ab6295de8df9ab4fc
Tree:
040fe8300d810c84ebf02e3bede474c5464bc33a
Author:
Omar Polo <op@omarpolo.com>
Date:
Sat Aug 13 12:30:06 2022 UTC
Message:
pledge amused-monitor
commit - 3fc7366684dd5a216deed3c8d7c69c1792022d5c
commit + 936bd53498d80451f2aeea9ab6295de8df9ab4fc
blob - ceaeaaa12c0fda45fd3feec1b535f2eb902e0742
blob + 5c13db34dce8e6805d91d1f1bb2ef66bac18c17c
--- contrib/amused-monitor
+++ contrib/amused-monitor
@@ -302,6 +302,22 @@ keypad 1;
my $poll = IO::Poll->new();
$poll->mask(\*STDIN => POLLIN);
$poll->mask($monitor => POLLIN);
+
+if (`uname` =~ "OpenBSD") {
+ use OpenBSD::Pledge;
+ use OpenBSD::Unveil;
+
+ my $prog = `which amused`;
+ chomp $prog;
+
+ unveil($prog, 'rx') or die "unveil $prog: $!";
+ if (defined($pfile)) {
+ unveil($pfile, 'wc') or die "unveil $pfile: $!";
+ pledge qw(stdio wpath cpath tty proc exec) or die "pledge: $!";
+ } else {
+ pledge qw(stdio tty proc exec) or die "pledge: $!";
+ }
+}
my $tick = 0;
my $tbefore = clock_gettime(CLOCK_MONOTONIC);
Omar Polo