Raise rb_eSystemCallError in case errno has not been set

This commit is contained in:
0x1eef 2024-03-20 17:24:10 -03:00
parent d7b70643aa
commit c88d5afb10

View file

@ -25,7 +25,7 @@ bsdcontrol_feature_status(VALUE self, VALUE path)
if (feature->hf_get(ctx, feature, &fd, &state) == RES_FAIL)
{
close(fd);
errno == 0 ? rb_raise(rb_eRuntimeError, "hf_get")
errno == 0 ? rb_raise(rb_eSystemCallError, "hf_get")
: rb_syserr_fail(errno, "hf_get");
}
else
@ -57,7 +57,7 @@ bsdcontrol_feature_set(VALUE self, VALUE path, VALUE rbstate)
if (feature->hf_apply(ctx, feature, &fd, &state) == RES_FAIL)
{
close(fd);
errno == 0 ? rb_raise(rb_eRuntimeError, "hf_apply")
errno == 0 ? rb_raise(rb_eSystemCallError, "hf_apply")
: rb_syserr_fail(errno, "hf_apply");
}
else