Skip to content

Commit

Permalink
nl(1): Capsicumise the utility
Browse files Browse the repository at this point in the history
Signed-off-by: Faraz Vahedi <[email protected]>
Reviewed by:    markj, oshogbo
MFC after:      1 week
Pull Request:   #1465
  • Loading branch information
kfv authored and oshogbo committed Dec 12, 2024
1 parent 4922431 commit dfd5232
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions usr.bin/nl/nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dfd5232

Please sign in to comment.