Hi guys, In the man page, the value is declared as rights, yet cap_rights_init, and cap_rights_limit use setrights. The following diff is the proposed fix: --- cap_rights_limit.2.orig 2014-12-06 20:36:26.000000000 +0400 +++ cap_rights_limit.2 2014-12-06 20:36:48.000000000 +0400 @@ -97,8 +97,8 @@ if (fd < 0) if (cap_enter() < 0) err(1, "cap_enter() failed"); -cap_rights_init(&setrights, CAP_READ); -if (cap_rights_limit(fd, &setrights) < 0) +cap_rights_init(&rights, CAP_READ); +if (cap_rights_limit(fd, &rights) < 0) err(1, "cap_rights_limit() failed"); buf[0] = 'X';
Created attachment 150270 [details] freebsd cap_rights_limit man page fix
Yup, this is wrong. I'll commit the fix.
Ah, it was fixed in HEAD in r263928, but never merged.
A commit references this bug: Author: brooks Date: Sat Dec 6 17:50:38 UTC 2014 New revision: 275566 URL: https://svnweb.freebsd.org/changeset/base/275566 Log: MFC r263928: Use the correct variable name in the example code. PR: 195749 Changes: _U stable/10/ stable/10/lib/libc/sys/cap_rights_limit.2
Different fix merged as r275566. Will appear in 10.2.