[前][次][番号順一覧][スレッド一覧]

ruby-changes:14697

From: akr <ko1@a...>
Date: Wed, 3 Feb 2010 20:09:13 +0900 (JST)
Subject: [ruby-changes:14697] Ruby:r26551 (trunk): * file.c (realpath_rec): rb_path_last_separator may return NULL.

akr	2010-02-03 20:08:44 +0900 (Wed, 03 Feb 2010)

  New Revision: 26551

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26551

  Log:
    * file.c (realpath_rec): rb_path_last_separator may return NULL.

  Modified files:
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26550)
+++ ChangeLog	(revision 26551)
@@ -1,3 +1,7 @@
+Wed Feb  3 20:08:05 2010  Tanaka Akira  <akr@f...>
+
+	* file.c (realpath_rec): rb_path_last_separator may return NULL.
+
 Wed Feb  3 13:15:24 2010  NARUSE, Yui  <naruse@r...>
 
 	* thread_pthread.c: DragonFlyBSD is also the same as FreeBSD
Index: file.c
===================================================================
--- file.c	(revision 26550)
+++ file.c	(revision 26551)
@@ -3097,7 +3097,8 @@
         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);
             }
         }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]