summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-16 02:43:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-16 02:43:55 +0000
commit803621f6d7e8415452fec49292b2b045dc04fa37 (patch)
treec6079e9786e253faedf45839d3f2072c62b2c731 /file.c
parent992b0148cacc7abbd439691460b5d937930e53ca (diff)
file.c: refine message
* file.c (rb_get_path_check_convert): refine the error message when the path name contains null byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/file.c b/file.c
index 55ed82954a..bc928f3dec 100644
--- a/file.c
+++ b/file.c
@@ -195,7 +195,9 @@ rb_get_path_check_convert(VALUE obj, VALUE tmp, int level)
}
check_path_encoding(tmp);
- StringValueCStr(tmp);
+ if (!rb_str_to_cstr(tmp)) {
+ rb_raise(rb_eArgError, "path name contains null byte");
+ }
return rb_str_new4(tmp);
}