Bug 195749 - FreeBSD 10.1 cap_rights_limit wrong example of usage
Summary: FreeBSD 10.1 cap_rights_limit wrong example of usage
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-06 16:40 UTC by logan
Modified: 2014-12-06 17:53 UTC (History)
1 user (show)

See Also:


Attachments
freebsd cap_rights_limit man page fix (455 bytes, patch)
2014-12-06 16:40 UTC, logan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description logan 2014-12-06 16:40:00 UTC
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';
Comment 1 logan 2014-12-06 16:40:37 UTC
Created attachment 150270 [details]
freebsd cap_rights_limit man page fix
Comment 2 Brooks Davis freebsd_committer freebsd_triage 2014-12-06 17:44:35 UTC
Yup, this is wrong.  I'll commit the fix.
Comment 3 Brooks Davis freebsd_committer freebsd_triage 2014-12-06 17:46:42 UTC
Ah, it was fixed in HEAD in r263928, but never merged.
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-12-06 17:51:28 UTC
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
Comment 5 Brooks Davis freebsd_committer freebsd_triage 2014-12-06 17:53:17 UTC
Different fix merged as r275566.  Will appear in 10.2.