diff options
-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); } } |