Raise SystemCallError instead of RuntimeError
This commit is contained in:
parent
29fb7a2ebf
commit
545c060fec
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue