summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLandry Breuil <landry@cvs.openbsd.org>2019-01-22 20:02:41 +0000
committerLandry Breuil <landry@cvs.openbsd.org>2019-01-22 20:02:41 +0000
commit5c0a71df6e14d3ae04cc0faa6dad6e5d0a01d27a (patch)
treea1a4970a78988ae47de1d44c3d194e7486a8643d
parent78a33b212bd4bbeb885b9b34ffc60698cacd948b (diff)
Pledge video(1):
* video -q needs 'stdio rpath wpath video' (needs O_RDWR on the device) * video -i needs 'stdio rpath' (rpath for X11 error/locale access) * other modes (ie display frames via X11, or output frames to file with -o/-O) need 'stdio rpath video' since we open output file/video device before calling pledge(2). with help from semarie@, nits from matthieu@ ok deraadt@
-rw-r--r--app/video/video.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/video/video.c b/app/video/video.c
index dec280ed0..2cd79a081 100644
--- a/app/video/video.c
+++ b/app/video/video.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: video.c,v 1.26 2019/01/04 17:45:00 landry Exp $ */
+/* $OpenBSD: video.c,v 1.27 2019/01/22 20:02:40 landry Exp $ */
/*
* Copyright (c) 2010 Jacob Meuser <jakemsr@openbsd.org>
*
@@ -1961,6 +1961,8 @@ main(int argc, char *argv[])
argv += optind;
if (vid.mode & M_QUERY) {
+ if (pledge("stdio rpath wpath video", NULL) == -1)
+ err(1, "pledge");
dev_dump_query(&vid);
cleanup(&vid, 0);
}
@@ -1971,6 +1973,14 @@ main(int argc, char *argv[])
if (!setup(&vid))
cleanup(&vid, 1);
+ if (vid.mode & M_IN_FILE) {
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio rpath video", NULL) == -1)
+ err(1, "pledge");
+ }
+
if (!stream(&vid))
cleanup(&vid, 1);