Raise an error when hbsdcontrol_set_feature_state failes

This commit is contained in:
0x1eef 2024-02-29 22:46:47 -03:00
parent a768d11ed9
commit d66df7f0b8
2 changed files with 14 additions and 5 deletions

View file

@ -43,7 +43,10 @@ feature_set(VALUE self, VALUE path, VALUE state)
if (r == 0) { if (r == 0) {
return Qtrue; return Qtrue;
} else { } else {
return Qfalse; VALUE rb_mBSD = rb_const_get(rb_cObject, rb_intern("BSD")),
rb_mControl = rb_const_get(rb_mBSD, rb_intern("Control")),
rb_eError = rb_const_get(rb_mControl, rb_intern("Error"));
rb_raise(rb_eError, "hbsdcontrol_set_feature_state failed");
} }
} }

View file

@ -8,10 +8,13 @@ module BSD::Control
end end
## ##
# Enables a feature for a given binary. # Enables a feature for a given executable.
# #
# @param [String] path # @param [String] path
# The path to a binary. # The path to an executable.
#
# @raise [BSD::Control::Error]
# When the operation fails.
# #
# @return [Boolean] # @return [Boolean]
# Returns true on success. # Returns true on success.
@ -20,10 +23,13 @@ module BSD::Control
end end
## ##
# Disables a feature for a given binary. # Disables a feature for a given executable.
# #
# @param [String] path # @param [String] path
# The path to a binary. # The path to an executable.
#
# @raise [BSD::Control::Error]
# When the operation fails.
# #
# @return [Boolean] # @return [Boolean]
# Returns true on success. # Returns true on success.