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

ruby-changes:39789

From: kosaki <ko1@a...>
Date: Wed, 16 Sep 2015 12:20:33 +0900 (JST)
Subject: [ruby-changes:39789] kosaki:r51870 (trunk): * dir.c (glob_helper): check pathtype once again by lstat(2) if

kosaki	2015-09-16 12:19:53 +0900 (Wed, 16 Sep 2015)

  New Revision: 51870

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

  Log:
    * dir.c (glob_helper): check pathtype once again by lstat(2) if
      dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN.

  Modified files:
    trunk/ChangeLog
    trunk/dir.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51869)
+++ ChangeLog	(revision 51870)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Sep 16 12:06:53 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* dir.c (glob_helper): check pathtype once again by lstat(2) if
+	  dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN.
+
 Wed Sep 16 03:49:19 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* test/ruby/test_thread.rb (TestThread#test_mutex_synchronize):
Index: dir.c
===================================================================
--- dir.c	(revision 51869)
+++ dir.c	(revision 51870)
@@ -1801,15 +1801,18 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L1801
 	    }
 	    name = buf + pathlen + (dirsep != 0);
 	    if (recursive && dotfile < ((flags & FNM_DOTMATCH) ? 2 : 1)) {
+#ifdef DT_UNKNOWN
+		if ((new_pathtype = dp->d_type) != (rb_pathtype_t)DT_UNKNOWN)
+		    /* Got it. We need nothing more. */
+		    ;
+		else
+		    /* fall back to call lstat(2) */
+#endif
 		/* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
-#ifndef DT_DIR
 		if (do_lstat(buf, &st, flags, enc) == 0)
 		    new_pathtype = IFTODT(st.st_mode);
 		else
 		    new_pathtype = path_noent;
-#else
-		new_pathtype = dp->d_type;
-#endif
 	    }
 
 	    new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, (end - beg) * 2);

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

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