summaryrefslogtreecommitdiff
path: root/ext/syslog/syslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/syslog/syslog.c')
-rw-r--r--ext/syslog/syslog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 5351b28fe6..317607eeef 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -150,6 +150,7 @@ static VALUE mSyslog_close(VALUE self)
static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self)
{
VALUE ident, opt, fac;
+ const char *ident_ptr;
if (syslog_opened) {
rb_raise(rb_eRuntimeError, "syslog already open");
@@ -160,8 +161,9 @@ static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self)
if (NIL_P(ident)) {
ident = rb_gv_get("$0");
}
- SafeStringValue(ident);
- syslog_ident = strdup(RSTRING_PTR(ident));
+ ident_ptr = StringValueCStr(ident);
+ rb_check_safe_obj(ident);
+ syslog_ident = strdup(ident_ptr);
if (NIL_P(opt)) {
syslog_options = LOG_PID | LOG_CONS;