Convert cap_enter() < 0 && errno != ENOSYS
to caph_enter() < 0
.
No functional change intended.
This commit is contained in:
parent
d18e2bca4b
commit
7672a0148f
@ -98,7 +98,7 @@ main(int argc __unused, char *argv[])
|
||||
setup();
|
||||
|
||||
caph_cache_catpages();
|
||||
if (cap_enter() == -1 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
(void)signal(SIGINFO, siginfo_handler);
|
||||
|
@ -82,7 +82,7 @@ main(int argc, char *argv[])
|
||||
char newline[] = "\n";
|
||||
char *progname = argv[0];
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
/* This utility may NOT do getopt(3) option parsing. */
|
||||
|
@ -70,7 +70,7 @@ main(int argc, char *argv[])
|
||||
time_t original;
|
||||
char buf[2];
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
if (argc != 2)
|
||||
|
@ -86,7 +86,7 @@ main(int argc, char *argv[])
|
||||
caph_cache_catpages();
|
||||
if (caph_limit_stdio() < 0)
|
||||
err(1, "Unable to limit stdio");
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "Unable to enter capability mode");
|
||||
|
||||
if (count == -1)
|
||||
|
@ -166,7 +166,7 @@ main(int argc, char **argv)
|
||||
err(EX_OSERR, "can't limit maildirfd rights");
|
||||
|
||||
/* Enter Capsicum capability sandbox */
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(EX_OSERR, "cap_enter");
|
||||
#endif
|
||||
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <capsicum_helpers.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
@ -167,7 +168,7 @@ decrypt(int ofd, const char *privkeyfile, const char *keyfile,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS) {
|
||||
if (caph_enter() < 0) {
|
||||
pjdlog_errno(LOG_ERR, "Unable to enter capability mode");
|
||||
goto failed;
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/capsicum.h>
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <capsicum_helpers.h>
|
||||
|
||||
#include <net80211/ieee80211_freebsd.h>
|
||||
|
||||
#ifndef _PATH_VAREMPTY
|
||||
@ -539,7 +541,7 @@ main(int argc, char *argv[])
|
||||
|
||||
setproctitle("%s", ifi->name);
|
||||
|
||||
if (CASPER_SUPPORT && cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter_casper() < 0)
|
||||
error("can't enter capability mode: %m");
|
||||
|
||||
if (immediate_daemon)
|
||||
|
@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <capsicum_helpers.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -227,7 +228,7 @@ genkey(const char *pubkeyfile, struct diocskerneldump_arg *kdap)
|
||||
if (fp == NULL)
|
||||
err(1, "Unable to open %s", pubkeyfile);
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "Unable to enter capability mode");
|
||||
|
||||
pubkey = RSA_new();
|
||||
|
@ -228,8 +228,7 @@ main(int argc, char *argv[])
|
||||
if (*(argv + 1) == NULL) {
|
||||
cap_rights_init(&rights, CAP_READ);
|
||||
if ((cap_rights_limit(fd, &rights) < 0 &&
|
||||
errno != ENOSYS) ||
|
||||
(cap_enter() < 0 && errno != ENOSYS))
|
||||
errno != ENOSYS) || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
}
|
||||
if ((p = Algorithm[digest].Fd(fd, buf)) == NULL) {
|
||||
@ -253,8 +252,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
} while (*++argv);
|
||||
} else if (!sflag && (optind == 1 || qflag || rflag)) {
|
||||
if (caph_limit_stdin() < 0 ||
|
||||
(cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdin() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
MDFilter(&Algorithm[digest], 0);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ main(int argc, char **argv)
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
aflag = 0;
|
||||
|
@ -188,7 +188,7 @@ main(int argc, char *argv[])
|
||||
|
||||
caph_cache_catpages();
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(ERR_EXIT, "unable to enter capability mode");
|
||||
|
||||
if (!special) {
|
||||
|
@ -144,7 +144,7 @@ main(int argc, char **argv)
|
||||
if (caph_limit_stdio() == -1)
|
||||
err(1, "unable to limit stdio");
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
max_bufd_lines = 256;
|
||||
|
@ -334,7 +334,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum)
|
||||
|
||||
caph_cache_catpages();
|
||||
caph_cache_tzdata();
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(2, "unable to enter capability mode");
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ main(int argc, char **argv)
|
||||
nleft++;
|
||||
|
||||
caph_cache_catpages();
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(2, "unable to enter capability mode");
|
||||
|
||||
/* parse diffs */
|
||||
|
@ -56,7 +56,7 @@ main(int argc, char **argv)
|
||||
char *p;
|
||||
int ch;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
while ((ch = getopt(argc, argv, "")) != -1)
|
||||
|
@ -579,7 +579,7 @@ main(int ac, char **av)
|
||||
caph_limit_stdout() < 0 || caph_limit_stderr() < 0) {
|
||||
err(1, "unable to limit rights for stdio");
|
||||
}
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
e = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (e == MAP_FAILED)
|
||||
|
@ -19,7 +19,7 @@ main(int argc, char *argv[])
|
||||
int c;
|
||||
int status = 0;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
optind = 2; /* Past the program name and the option letters. */
|
||||
|
@ -372,7 +372,7 @@ next(char **argv)
|
||||
* We've opened our last input file; enter capsicum sandbox.
|
||||
*/
|
||||
if (statok == 0 || *(_argv + 1) == NULL) {
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ main(int argc, char **argv)
|
||||
err(EXIT_FAILURE, "iconv_open(%s, %s)", opt_t, opt_f);
|
||||
|
||||
if (argc == 0) {
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(EXIT_FAILURE, "unable to enter capability mode");
|
||||
res = do_conv(stdin, cd, opt_s, opt_c);
|
||||
} else {
|
||||
@ -228,7 +228,7 @@ main(int argc, char **argv)
|
||||
err(EXIT_FAILURE, "Cannot open `%s'",
|
||||
argv[i]);
|
||||
/* Enter Capsicum sandbox for final input file. */
|
||||
if (i + 1 == argc && cap_enter() < 0 && errno != ENOSYS)
|
||||
if (i + 1 == argc && caph_enter() < 0)
|
||||
err(EXIT_FAILURE,
|
||||
"unable to enter capability mode");
|
||||
res |= do_conv(fp, cd, opt_s, opt_c);
|
||||
|
@ -256,7 +256,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Enter Capsicum sandbox. */
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(EXIT_FAILURE, "unable to enter capability mode");
|
||||
|
||||
for (i = 0; i < (int)nfds; i++) {
|
||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/capsicum.h>
|
||||
#include <capsicum_helpers.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -248,7 +249,7 @@ main(int argc, char **argv)
|
||||
cap_rights_init(&rights, CAP_FSTAT, CAP_READ);
|
||||
if (cap_rights_limit(fileno(input), &rights) < 0 && errno != ENOSYS)
|
||||
err(EXIT_FAILURE, "unable to limit rights for %s", in_name);
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(EXIT_FAILURE, "unable to enter capability mode");
|
||||
|
||||
if (opt.com_ind <= 1)
|
||||
|
@ -123,7 +123,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
caph_cache_catpages();
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1)
|
||||
|
@ -434,12 +434,12 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
if (resolv == 0 || (cappwd != NULL && capgrp != NULL)) {
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
}
|
||||
#else
|
||||
if (resolv == 0) {
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
}
|
||||
#endif
|
||||
|
@ -203,7 +203,7 @@ main(int ac, char **av)
|
||||
* kvm_nlist() above uses kldsym(2) for native kernels, and that isn't
|
||||
* allowed in the sandbox.
|
||||
*/
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
if (iflag) {
|
||||
|
@ -99,7 +99,7 @@ main(int argc, char *argv[])
|
||||
* mode.
|
||||
*/
|
||||
caph_cache_catpages();
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
for (;;) {
|
||||
|
@ -190,7 +190,7 @@ main(int argc, char *argv[])
|
||||
if (setutxdb(UTXDB_LOG, file) != 0)
|
||||
err(1, "%s", file != NULL ? file : "(default utx db)");
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "cap_enter");
|
||||
|
||||
if (sflag && width == 8) usage();
|
||||
|
@ -61,7 +61,6 @@ static char sccsid[] = "@(#)locate.bigram.c 8.1 (Berkeley) 6/6/93";
|
||||
|
||||
#include <capsicum_helpers.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
@ -78,7 +77,7 @@ main(void)
|
||||
u_char *oldpath = buf1, *path = buf2;
|
||||
u_int i, j;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
while (fgets(path, sizeof(buf2), stdin) != NULL) {
|
||||
|
@ -54,7 +54,7 @@ main(int argc, char *argv[] __unused)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
if (argc != 1)
|
||||
|
@ -634,7 +634,7 @@ main(int argc, char **argv)
|
||||
setfilenames[i]);
|
||||
|
||||
/* Enter Capsicum sandbox. */
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(2, "unable to enter capability mode");
|
||||
|
||||
for (i = 0; i < nds; i++) {
|
||||
|
@ -97,7 +97,7 @@ main(int argc, char **argv)
|
||||
err(1, "unable to limit capabitilities for stdio");
|
||||
|
||||
caph_cache_catpages();
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
while ((ch = getopt(argc, argv, "d:pt:")) != -1)
|
||||
|
@ -61,7 +61,7 @@ static const char rcsid[] =
|
||||
* validation check: there are 664579 primes between 0 and 10^7
|
||||
*/
|
||||
|
||||
#include <sys/capsicum.h>
|
||||
#include <capsicum_helpers.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
@ -104,7 +104,7 @@ main(int argc, char *argv[])
|
||||
/* Cache NLS data, for strerror, for err(3), before cap_enter. */
|
||||
(void)catopen("libc", NL_CAT_LOCALE);
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "cap_enter");
|
||||
|
||||
while ((ch = getopt(argc, argv, "h")) != -1)
|
||||
|
@ -69,7 +69,7 @@ main(int argc, char *argv[])
|
||||
size_t len;
|
||||
int ch;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
while ((ch = getopt(argc, argv, "")) != -1)
|
||||
|
@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <protocols/rwhod.h>
|
||||
|
||||
#include <capsicum_helpers.h>
|
||||
#include <dirent.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
@ -136,7 +137,7 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
(void) time(&ct);
|
||||
(void) localtime(&ct);
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "cap_enter");
|
||||
(void) time(&now);
|
||||
cap_rights_init(&rights, CAP_READ);
|
||||
|
@ -109,7 +109,7 @@ main(int argc, char *argv[])
|
||||
} else
|
||||
add(fd, *argv);
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(EXIT_FAILURE, "unable to enter capability mode");
|
||||
while ((rval = read(STDIN_FILENO, buf, BSIZE)) > 0)
|
||||
for (p = head; p; p = p->next) {
|
||||
|
@ -84,7 +84,7 @@ main(int argc, char **argv)
|
||||
if (caph_limit_stdio() == -1)
|
||||
err(1, "unable to limit stdio");
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
Cflag = cflag = dflag = sflag = 0;
|
||||
|
@ -48,6 +48,7 @@ static const char rcsid[] =
|
||||
|
||||
#include <sys/capsicum.h>
|
||||
|
||||
#include <capsicum_helpers.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
@ -177,7 +178,7 @@ main (int argc, char *argv[])
|
||||
}
|
||||
|
||||
strerror_init();
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
prevbuflen = thisbuflen = 0;
|
||||
|
@ -33,7 +33,7 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/capsicum.h>
|
||||
#include <capsicum_helpers.h>
|
||||
|
||||
#ifndef UNITSFILE
|
||||
#define UNITSFILE "/usr/share/misc/definitions.units"
|
||||
@ -819,7 +819,7 @@ main(int argc, char **argv)
|
||||
readunits(NULL);
|
||||
|
||||
if (optind == argc - 2) {
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
havestr = argv[optind];
|
||||
@ -843,7 +843,7 @@ main(int argc, char **argv)
|
||||
if (inhistory == 0)
|
||||
err(1, "Could not initialize history");
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "unable to enter capability mode");
|
||||
|
||||
if (!quiet)
|
||||
|
@ -137,7 +137,7 @@ main(int argc, char **argv)
|
||||
login = "???";
|
||||
}
|
||||
|
||||
if (cap_enter() < 0 && errno != ENOSYS)
|
||||
if (caph_enter() < 0)
|
||||
err(1, "cap_enter");
|
||||
|
||||
while (getopt(argc, argv, "") != -1)
|
||||
|
@ -60,7 +60,7 @@ main(int argc, char **argv)
|
||||
size_t more;
|
||||
ssize_t ret;
|
||||
|
||||
if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
|
||||
if (caph_limit_stdio() < 0 || caph_enter() < 0)
|
||||
err(1, "capsicum");
|
||||
|
||||
if (argc > 1) {
|
||||
|
@ -1114,7 +1114,7 @@ main(int argc, char *argv[])
|
||||
if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1)
|
||||
errx(EX_OSERR, "Unable to apply rights for sandbox");
|
||||
|
||||
if (cap_enter() == -1 && errno != ENOSYS)
|
||||
if (caph_enter() == -1)
|
||||
errx(EX_OSERR, "cap_enter() failed");
|
||||
#endif
|
||||
|
||||
|
@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <protocols/rwhod.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <capsicum_helpers.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -372,7 +373,7 @@ receiver_process(void)
|
||||
syslog(LOG_WARNING, "cap_rights_limit: %m");
|
||||
exit(1);
|
||||
}
|
||||
if (cap_enter() < 0 && errno != ENOSYS) {
|
||||
if (caph_enter() < 0) {
|
||||
syslog(LOG_ERR, "cap_enter: %m");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user