Date: Fri, 30 Sep 2016 13:50:59 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306502 - head/usr.bin/primes Message-ID: <201609301350.u8UDoxZx066804@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Fri Sep 30 13:50:59 2016 New Revision: 306502 URL: https://svnweb.freebsd.org/changeset/base/306502 Log: primes: trivially capsicumize Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7982 Modified: head/usr.bin/primes/primes.c Modified: head/usr.bin/primes/primes.c ============================================================================== --- head/usr.bin/primes/primes.c Fri Sep 30 13:49:50 2016 (r306501) +++ head/usr.bin/primes/primes.c Fri Sep 30 13:50:59 2016 (r306502) @@ -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':
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609301350.u8UDoxZx066804>