[Bug 268101] Inconsistent use of errno in cap_sysctl.h

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 01 Dec 2022 16:59:07 UTC

            Bug ID: 268101
           Summary: Inconsistent use of errno in cap_sysctl.h
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

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

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

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.

You are receiving this mail because:
You are the assignee for the bug.