summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-09 06:53:33 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-09 06:53:33 +0000
commite6716b5e38003a595254abbf92757e5a98cf287a (patch)
tree3e03b3400ed43c8555e5310d570777c416c82466
parentd8a84ddbf3715ae64a38bfd4bc547e33f9e13d58 (diff)
merge revision(s) 40001: [Backport #8609]
* win32/win32.c (wrename): use MoveFileExW instead of MoveFileW, because the latter fails on cross device file move of some environments. fix [ruby-core:53492] [Bug #8109] reported by mitchellh (Mitchell Hashimoto) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@42460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--version.h2
-rw-r--r--win32/win32.c24
3 files changed, 21 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index dd01390f8f..f8f109b083 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Aug 9 15:50:11 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (wrename): use MoveFileExW instead of MoveFileW,
+ because the latter fails on cross device file move of some
+ environments.
+ fix [ruby-core:53492] [Bug #8109]
+ reported by mitchellh (Mitchell Hashimoto)
+
Thu Aug 8 16:09:26 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* test/coverage/test_coverage.rb (TestCoverage#test_big_code): use `1'
diff --git a/version.h b/version.h
index 387b604d93..a735292053 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 460
+#define RUBY_PATCHLEVEL 461
#define RUBY_RELEASE_DATE "2013-08-09"
#define RUBY_RELEASE_YEAR 2013
diff --git a/win32/win32.c b/win32/win32.c
index fbf35664b6..e04edccd8a 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4023,18 +4023,18 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath)
if (newatts != -1 && newatts & FILE_ATTRIBUTE_READONLY)
SetFileAttributesW(newpath, newatts & ~ FILE_ATTRIBUTE_READONLY);
- if (!MoveFileW(oldpath, newpath))
- res = -1;
-
- if (res) {
- switch (GetLastError()) {
- case ERROR_ALREADY_EXISTS:
- case ERROR_FILE_EXISTS:
- if (IsWinNT()) {
- if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
- res = 0;
- }
- else {
+ if (IsWinNT()) {
+ if (!MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED))
+ res = -1;
+ }
+ else {
+ if (!MoveFileW(oldpath, newpath))
+ res = -1;
+
+ if (res) {
+ switch (GetLastError()) {
+ case ERROR_ALREADY_EXISTS:
+ case ERROR_FILE_EXISTS:
for (;;) {
if (!DeleteFileW(newpath) && GetLastError() != ERROR_FILE_NOT_FOUND)
break;