nl(1): Capsicumise the utility

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/1465
This commit is contained in:
Faraz Vahedi 2024-10-13 23:33:25 +03:30 committed by Mariusz Zaborski
parent 49224311fe
commit dfd52321b7

View file

@ -42,6 +42,8 @@
#include <unistd.h>
#include <wchar.h>
#include <capsicum_helpers.h>
typedef enum {
number_all, /* number all lines */
number_nonempty, /* number non-empty lines */
@ -244,6 +246,11 @@ main(int argc, char *argv[])
/* NOTREACHED */
}
/* Limit standard descriptors and enter capability mode */
caph_cache_catpages();
if (caph_limit_stdio() < 0 || caph_enter() < 0)
err(EXIT_FAILURE, "capsicum");
/* Generate the delimiter sequence */
memcpy(delim, delim1, delim1len);
memcpy(delim + delim1len, delim2, delim2len);