1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

win32.c: symlink than directory

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-03-30 05:42:44 +00:00
parent 5dc51d821e
commit 921bca8969
2 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Mon Mar 30 14:42:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* io.c (copy_stream_body): use the arguments without conversion if

View file

@ -5083,11 +5083,11 @@ fileattr_to_unixmode(DWORD attr, const WCHAR *path)
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 stati64 *st)
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;
}