Bug 268101 - Inconsistent use of errno in cap_sysctl.h
Summary: Inconsistent use of errno in cap_sysctl.h
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-01 16:59 UTC by Alan Somers
Modified: 2022-12-08 05:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2022-12-01 16:59:07 UTC
If WITH_CASPER is defined, then all of the functions in cap_sysctl.h will set errno on failure.  However, if it is not defined, then all of those functions' stubs will fail yet not set errno.  errno will be populated with some stale value.

Instead, the stubs should set errno.  Perhaps EOPNOTSUPP?  Or even EDOOFUS because the caller shouldn't be using those functions without defining WITH_CASPER?

In fact, I think it would've been a better design decision if those functions would succeed whenever capability mode is disabled, much like caph_enter.  But that horse has left the barn.