From f991debdcc3cbba721029285e4a77f32d8222aa1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 Feb 2014 03:01:46 +0000 Subject: tryopen: additional debug information for bad Errno values In case users run into the same problem in the future. ref: http://mid.gmane.org/20131227074129.GA6381@dcvr.yhbt.net --- ext/kgio/tryopen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/kgio/tryopen.c b/ext/kgio/tryopen.c index 1d097c7..50bacf4 100644 --- a/ext/kgio/tryopen.c +++ b/ext/kgio/tryopen.c @@ -171,7 +171,13 @@ void init_kgio_tryopen(void) switch (TYPE(err)) { case T_SYMBOL: const_id = SYM2ID(err); break; case T_STRING: const_id = rb_intern(RSTRING_PTR(err)); break; - default: rb_bug("constant not a symbol or string"); + default: { + VALUE i = rb_inspect(err); + const char *s = RSTRING_PTR(i); + + rb_bug("constant not a symbol or string: %s", s); + RB_GC_GUARD(i); + } } error = rb_const_get(rb_mErrno, const_id); -- cgit v1.2.3-24-ge0c7