From 1e1964b8f2edeba4dabab2d20b2b56e93a2e0257 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 2 Jun 2017 03:54:19 +0000 Subject: file.c: preserve encoding * file.c (rb_find_file_safe): preserve encoding of path in SecurityError messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 71bc0ba8cf..7d2d9e88bf 100644 --- a/file.c +++ b/file.c @@ -5840,7 +5840,7 @@ rb_find_file_safe(VALUE path, int safe_level) if (f[0] == '~') { tmp = file_expand_path_1(path); if (safe_level >= 1 && OBJ_TAINTED(tmp)) { - rb_raise(rb_eSecurityError, "loading from unsafe file %s", f); + rb_raise(rb_eSecurityError, "loading from unsafe file %"PRIsVALUE, tmp); } path = copy_path_class(tmp, path); f = RSTRING_PTR(path); @@ -5849,7 +5849,7 @@ rb_find_file_safe(VALUE path, int safe_level) if (expanded || rb_is_absolute_path(f) || is_explicit_relative(f)) { if (safe_level >= 1 && !fpath_check(path)) { - rb_raise(rb_eSecurityError, "loading from unsafe path %s", f); + rb_raise(rb_eSecurityError, "loading from unsafe path %"PRIsVALUE, path); } if (!rb_file_load_ok(f)) return 0; if (!expanded) @@ -5881,7 +5881,7 @@ rb_find_file_safe(VALUE path, int safe_level) found: if (safe_level >= 1 && !fpath_check(tmp)) { - rb_raise(rb_eSecurityError, "loading from unsafe file %s", f); + rb_raise(rb_eSecurityError, "loading from unsafe file %"PRIsVALUE, tmp); } return copy_path_class(tmp, path); -- cgit v1.2.3