summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 9327022328..6448634f11 100644
--- a/dir.c
+++ b/dir.c
@@ -648,8 +648,9 @@ dir_s_chdir(argc, argv, obj)
if (rb_block_given_p()) {
struct chdir_data args;
+ char *cwd = my_getcwd();
- args.old_path = rb_str_new2(my_getcwd());
+ args.old_path = rb_tainted_str_new2(cwd); free(cwd);
args.new_path = path;
args.done = Qfalse;
return rb_ensure(chdir_yield, (VALUE)&args, chdir_restore, (VALUE)&args);