1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

primes: trivially capsicumize

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7982
This commit is contained in:
Ed Maste 2016-09-30 13:50:59 +00:00
parent 968e30efd5
commit 6cd8c11ba5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306502

View File

@ -61,6 +61,7 @@ static const char rcsid[] =
* validation check: there are 664579 primes between 0 and 10^7
*/
#include <sys/capsicum.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@ -70,6 +71,7 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nl_types.h>
#include <unistd.h>
#include "primes.h"
@ -99,6 +101,12 @@ main(int argc, char *argv[])
int ch;
char *p;
/* Cache NLS data, for strerror, for err(3), before cap_enter. */
(void)catopen("libc", NL_CAT_LOCALE);
if (cap_enter() < 0 && errno != ENOSYS)
err(1, "cap_enter");
while ((ch = getopt(argc, argv, "h")) != -1)
switch (ch) {
case 'h':