Index: usr.bin/primes/primes.c =================================================================== --- usr.bin/primes/primes.c +++ usr.bin/primes/primes.c @@ -61,6 +61,7 @@ * validation check: there are 664579 primes between 0 and 10^7 */ +#include #include #include #include @@ -70,6 +71,7 @@ #include #include #include +#include #include #include "primes.h" @@ -99,6 +101,15 @@ int ch; char *p; + /* + * Cache NLS data, for strerror, for err(3), before entering capability + * mode. + */ + (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':