This commit is contained in:
0x1eef 2024-06-25 04:46:47 -03:00
parent f7aa10ba23
commit b1f1e9d5d6

View file

@ -9,7 +9,7 @@ module BSD::Capsicum
extend self extend self
## ##
# Check if we're in capability mode. # Check if we're in capability mode
# #
# @see https://man.freebsd.org/cgi/man.cgi?query=cap_getmode&apropos=0&sektion=2&format=html cap_getmode(2) # @see https://man.freebsd.org/cgi/man.cgi?query=cap_getmode&apropos=0&sektion=2&format=html cap_getmode(2)
# @raise [SystemCallError] # @raise [SystemCallError]
@ -18,7 +18,6 @@ module BSD::Capsicum
# Returns true when the current process is in capability mode # Returns true when the current process is in capability mode
def in_capability_mode? def in_capability_mode?
uintp = Fiddle::Pointer.malloc(Fiddle::SIZEOF_UINT) uintp = Fiddle::Pointer.malloc(Fiddle::SIZEOF_UINT)
FFI.cap_getmode(uintp)
if FFI.cap_getmode(uintp).zero? if FFI.cap_getmode(uintp).zero?
uintp[0, Fiddle::SIZEOF_UINT].unpack("i") == [1] uintp[0, Fiddle::SIZEOF_UINT].unpack("i") == [1]
else else