From 545c060fecd08133aab548343aa30375ea023b57 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sat, 30 Mar 2024 03:48:26 -0300 Subject: [PATCH] Raise SystemCallError instead of RuntimeError --- ext/bsdcontrol.rb/context.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/bsdcontrol.rb/context.c b/ext/bsdcontrol.rb/context.c index 54cdb03..aa3182e 100644 --- a/ext/bsdcontrol.rb/context.c +++ b/ext/bsdcontrol.rb/context.c @@ -14,9 +14,13 @@ bsdcontrol_context_alloc(VALUE klass) struct bsdcontrol_ctx_t *rbctx; ctx = hbsdctrl_ctx_new(FLAGS, NAMESPACE); 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; return Data_Wrap_Struct(klass, NULL, bsdcontrol_context_free, rbctx);