aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMariusz Zaborski <oshogbo@FreeBSD.org>2018-06-19 23:43:14 +0000
committerMariusz Zaborski <oshogbo@FreeBSD.org>2018-06-19 23:43:14 +0000
commit7672a0148f79063eac8f8e0beb0db5350d02d5d4 (patch)
tree413e973544ce3e0e8cc69352f5f5824b3a8821d5 /sbin
parentd18e2bca4b12aba1820c63c125e409418007db49 (diff)
downloadsrc-7672a0148f79063eac8f8e0beb0db5350d02d5d4.tar.gz
src-7672a0148f79063eac8f8e0beb0db5350d02d5d4.zip
Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.
No functional change intended.
Notes
Notes: svn path=/head/; revision=335395
Diffstat (limited to 'sbin')
-rw-r--r--sbin/decryptcore/decryptcore.c3
-rw-r--r--sbin/dhclient/dhclient.c4
-rw-r--r--sbin/dumpon/dumpon.c3
-rw-r--r--sbin/md5/md5.c6
4 files changed, 9 insertions, 7 deletions
diff --git a/sbin/decryptcore/decryptcore.c b/sbin/decryptcore/decryptcore.c
index 0f054d33502d..76003d60a761 100644
--- a/sbin/decryptcore/decryptcore.c
+++ b/sbin/decryptcore/decryptcore.c
@@ -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;
}
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 7150a0916499..37fd46abbba1 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -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)
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index cc5622bcd229..998d0d48c256 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -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();
diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c
index 858e80b5d010..06f322a65fb1 100644
--- a/sbin/md5/md5.c
+++ b/sbin/md5/md5.c
@@ -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);
}