summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-24 17:51:02 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-24 17:51:02 +0000
commitf3d7d9fe48148bfd38d51443912994e04c4800dd (patch)
tree9391ebc4ad73e87fe1d0f0a93f4a5b232683dc02 /file.c
parent9ce5d1f0f5d1c87406ba644c5f2662a6a1b843b3 (diff)
* file.c (rb_file_s_rename): avoid Cygwin's bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/file.c b/file.c
index c4e6781ae7..c8970f787c 100644
--- a/file.c
+++ b/file.c
@@ -1252,8 +1252,13 @@ rb_file_s_rename(obj, from, to)
Check_SafeStr(from);
Check_SafeStr(to);
- if (rename(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0)
+ if (rename(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0) {
+#if defined __CYGWIN__
+ extern unsigned long __attribute__((stdcall)) GetLastError();
+ errno = GetLastError(); /* This is a Cygwin bug */
+#endif
rb_sys_fail(RSTRING(from)->ptr);
+ }
return INT2FIX(0);
}