Date: Wed, 5 May 2021 15:02:02 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 11af9a9cf930 - stable/13 - cap_sysctl.3: Fix bugs in the example Message-ID: <202105051502.145F22FG061754@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=11af9a9cf930123ba164ffc63976fe1d67ce614e commit 11af9a9cf930123ba164ffc63976fe1d67ce614e Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-04-28 14:38:52 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-05 15:01:56 +0000 cap_sysctl.3: Fix bugs in the example - Correct the type of the sysctl value. - Initialize the oldsize parameter to cap_sysctlbyname() Sponsored by: The FreeBSD Foundation (cherry picked from commit 44bbda649dc6c1cdc5a99641e14c77157967e140) --- lib/libcasper/services/cap_sysctl/cap_sysctl.3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libcasper/services/cap_sysctl/cap_sysctl.3 b/lib/libcasper/services/cap_sysctl/cap_sysctl.3 index 5d840796515e..0a7d009e1c3c 100644 --- a/lib/libcasper/services/cap_sysctl/cap_sysctl.3 +++ b/lib/libcasper/services/cap_sysctl/cap_sysctl.3 @@ -131,8 +131,8 @@ capability to get the value of cap_channel_t *capcas, *capsysctl; const char *name = "kern.trap_enotcap"; void *limit; -int value; size_t size; +bool value; /* Open capability to Casper. */ capcas = cap_init(); @@ -160,6 +160,7 @@ if (cap_sysctl_limit(limit) < 0) err(1, "Unable to set limits"); /* Fetch value. */ +size = sizeof(value); if (cap_sysctlbyname(capsysctl, name, &value, &size, NULL, 0) < 0) err(1, "Unable to get value of sysctl");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105051502.145F22FG061754>