from(1): Capsicumise

Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp, oshogbo, markj (previous version)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1491
This commit is contained in:
Faraz Vahedi
2024-11-01 14:33:56 +03:30
committed by Mariusz Zaborski
parent dde5113f47
commit 4a4c885337
+4
View File
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <capsicum_helpers.h>
#include <ctype.h>
#include <err.h>
#include <pwd.h>
@@ -102,6 +103,9 @@ main(int argc, char **argv)
else if ((mbox = fopen(file, "r")) == NULL) {
errx(EXIT_FAILURE, "can't read %s", file);
}
if (caph_limit_stdio() < 0 || caph_enter() < 0) {
err(EXIT_FAILURE, "capsicum");
}
for (newline = 1; fgets(buf, sizeof(buf), mbox);) {
if (*buf == '\n') {
newline = 1;