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

ruby-changes:38039

From: nobu <ko1@a...>
Date: Mon, 30 Mar 2015 14:43:00 +0900 (JST)
Subject: [ruby-changes:38039] nobu:r50120 (trunk): win32.c: symlink than directory

nobu	2015-03-30 14:42:44 +0900 (Mon, 30 Mar 2015)

  New Revision: 50120

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

  Log:
    win32.c: symlink than directory
    
    * win32/win32.c (fileattr_to_unixmode, winnt_lstat): deal with
      symbolic link than directory, and set executable bits.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50119)
+++ ChangeLog	(revision 50120)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar 30 14:42:41 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/win32.c (fileattr_to_unixmode, winnt_lstat): deal with
+	  symbolic link than directory, and set executable bits.
+
 Mon Mar 30 11:27:54 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (copy_stream_body): use the arguments without conversion if
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 50119)
+++ win32/win32.c	(revision 50120)
@@ -5083,11 +5083,11 @@ fileattr_to_unixmode(DWORD attr, const W https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5083
 	mode |= S_IREAD | S_IWRITE | S_IWUSR;
     }
 
-    if (attr & FILE_ATTRIBUTE_DIRECTORY) {
-	mode |= S_IFDIR | S_IEXEC;
+    if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
+	mode |= S_IFLNK | S_IEXEC;
     }
-    else if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
-	mode |= S_IFLNK;
+    else if (attr & FILE_ATTRIBUTE_DIRECTORY) {
+	mode |= S_IFDIR | S_IEXEC;
     }
     else {
 	mode |= S_IFREG;
@@ -5253,7 +5253,11 @@ winnt_lstat(const WCHAR *path, struct st https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5253
 	return -1;
     }
     if (GetFileAttributesExW(path, GetFileExInfoStandard, (void*)&wfa)) {
-	if (wfa.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+	if (wfa.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+	    /* TODO: size in which encoding? */
+	    st->st_size = 0;
+	}
+	else if (wfa.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
 	    if (check_valid_dir(path)) return -1;
 	    st->st_size = 0;
 	}

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

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