win32.c: ELOOP at wrename

* win32/win32.c (wrename): fail with ELOOP if failed to resolve
  the old path name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-08-26 16:22:56 +00:00
parent 74842faf64
commit 8504c817e3

View File

@ -5009,6 +5009,18 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath)
errno = map_errno(GetLastError());
return -1;
}
if (oldatts & FILE_ATTRIBUTE_REPARSE_POINT) {
HANDLE fh = CreateFileW(oldpath, 0, 0, NULL, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (fh == INVALID_HANDLE_VALUE) {
int e = GetLastError();
if (e == ERROR_CANT_RESOLVE_FILENAME) {
errno = ELOOP;
return -1;
}
}
CloseHandle(fh);
}
RUBY_CRITICAL({
if (newatts != -1 && newatts & FILE_ATTRIBUTE_READONLY)