summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 05:42:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 05:42:44 +0000
commit921bca89698a53f58c8a8934a494311275630a01 (patch)
tree13cd6565407a47c8e294587ce626442b902d3156 /win32
parent5dc51d821ef76c610d64464d511c34bf6b67e74a (diff)
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
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b3adc11..d038464 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -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;
}