From bec6dc30e1a6ec4e96d8b29510d345e3f2a8ea40 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 25 Jun 2018 11:44:41 +0000 Subject: [PATCH] users(1): Use capsicum helpers for users In doing so also fix the libcasper.h header to work in C++. --- lib/libcasper/libcasper/libcasper.h | 2 +- usr.bin/users/users.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libcasper/libcasper/libcasper.h b/lib/libcasper/libcasper/libcasper.h index 81d65f5618e..e3d9f616b72 100644 --- a/lib/libcasper/libcasper/libcasper.h +++ b/lib/libcasper/libcasper/libcasper.h @@ -105,7 +105,7 @@ cap_init(void) { cap_channel_t *chan; - chan = malloc(sizeof(*chan)); + chan = (cap_channel_t *)malloc(sizeof(*chan)); if (chan != NULL) { chan->cch_fd = -1; } diff --git a/usr.bin/users/users.cc b/usr.bin/users/users.cc index 40d5c3017ad..44b1f591e05 100644 --- a/usr.bin/users/users.cc +++ b/usr.bin/users/users.cc @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -56,7 +57,7 @@ main(int argc, char **) setutxent(); - if (cap_enter() < 0 && errno != ENOSYS) + if (caph_enter()) err(1, "Failed to enter capability mode."); while ((ut = getutxent()) != NULL)