git: 95498a5acc08 - main - colrm(1): Capsicumise

From: Mariusz Zaborski <oshogbo_at_FreeBSD.org>
Date: Wed, 27 Nov 2024 12:22:46 UTC
The branch main has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=95498a5acc0888ed2e73237b82a1e90f109473f9

commit 95498a5acc0888ed2e73237b82a1e90f109473f9
Author:     Faraz Vahedi <kfv@kfv.io>
AuthorDate: 2024-10-27 09:01:01 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2024-11-27 12:22:50 +0000

    colrm(1): Capsicumise
    
    Signed-off-by: Faraz Vahedi <kfv@kfv.io>
    Reviewed by:    markj, oshogbo
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1496
---
 usr.bin/colrm/colrm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usr.bin/colrm/colrm.c b/usr.bin/colrm/colrm.c
index 7f758b9cfbc6..20bbd6e9a622 100644
--- a/usr.bin/colrm/colrm.c
+++ b/usr.bin/colrm/colrm.c
@@ -40,6 +40,8 @@
 #include <unistd.h>
 #include <wchar.h>
 
+#include <capsicum_helpers.h>
+
 #define	TAB	8
 
 void check(FILE *);
@@ -54,6 +56,10 @@ main(int argc, char *argv[])
 
 	setlocale(LC_ALL, "");
 
+	caph_cache_catpages();
+	if (caph_limit_stdio() < 0 || caph_enter() < 0)
+		err(EXIT_FAILURE, "capsicum");
+
 	while ((ch = getopt(argc, argv, "")) != -1)
 		switch(ch) {
 		case '?':