diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-03 11:08:44 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-03 11:08:44 +0000 |
commit | 688ca71c13c46ef7df022845266eb4549b98f38c (patch) | |
tree | 87a65d27231c9a605f2417f81fdf2ae658d21615 | |
parent | 44b5a74a9ae22aa08f226b7f1d555fad928a8cf7 (diff) | |
download | ruby-688ca71c13c46ef7df022845266eb4549b98f38c.tar.gz |
* file.c (realpath_rec): rb_path_last_separator may return NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | file.c | 3 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Wed Feb 3 20:08:05 2010 Tanaka Akira <akr@fsij.org> + + * file.c (realpath_rec): rb_path_last_separator may return NULL. + Wed Feb 3 13:15:24 2010 NARUSE, Yui <naruse@ruby-lang.org> * thread_pthread.c: DragonFlyBSD is also the same as FreeBSD @@ -3097,7 +3097,8 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, char *unresolved, VALUE loopche else if (testnamelen == 2 && testname[0] == '.' && testname[1] == '.') { if (*prefixlenp < RSTRING_LEN(*resolvedp)) { char *resolved_names = RSTRING_PTR(*resolvedp) + *prefixlenp; - long len = rb_path_last_separator(resolved_names) - resolved_names; + char *lastsep = rb_path_last_separator(resolved_names); + long len = lastsep ? lastsep - resolved_names : 0; rb_str_set_len(*resolvedp, *prefixlenp + len); } } |