Raise SystemCallError instead of RuntimeError

This commit is contained in:
0x1eef 2024-03-30 03:48:26 -03:00
parent 29fb7a2ebf
commit 545c060fec

View file

@ -14,9 +14,13 @@ bsdcontrol_context_alloc(VALUE klass)
struct bsdcontrol_ctx_t *rbctx; struct bsdcontrol_ctx_t *rbctx;
ctx = hbsdctrl_ctx_new(FLAGS, NAMESPACE); ctx = hbsdctrl_ctx_new(FLAGS, NAMESPACE);
rbctx = calloc(1, sizeof(struct bsdcontrol_ctx_t)); rbctx = calloc(1, sizeof(struct bsdcontrol_ctx_t));
if (ctx == NULL || rbctx == NULL) if (ctx == NULL)
{ {
rb_raise(rb_eRuntimeError, "..."); rb_raise(rb_eSystemCallError, "hbsdctrl_ctx_new");
}
else if (rbctx == NULL)
{
rb_raise(rb_eSystemCallError, "calloc");
} }
rbctx->ctx = ctx; rbctx->ctx = ctx;
return Data_Wrap_Struct(klass, NULL, bsdcontrol_context_free, rbctx); return Data_Wrap_Struct(klass, NULL, bsdcontrol_context_free, rbctx);