aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index b299689a38..fa63537ab5 100644
--- a/io.c
+++ b/io.c
@@ -3455,8 +3455,8 @@ rb_io_s_sysopen(int argc, VALUE *argv)
if (NIL_P(perm)) fmode = 0666;
else fmode = NUM2INT(perm);
- path = ALLOCA_N(char, strlen(RSTRING_PTR(fname))+1);
- strcpy(path, RSTRING_PTR(fname));
+ RB_GC_GUARD(fname) = rb_str_new4(fname);
+ path = RSTRING_PTR(fname);
fd = rb_sysopen(path, flags, fmode);
return INT2NUM(fd);
}