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
commitf930fc33ddc1e30b5b2fc3d70f16fc4d3d567ac2 (patch)
treef0112c6fc162bf3aa68e715b5dbf60035dfc2328 /file.c
parente5c14ce5007bea9785fd68fab0fd8c4bd9bd4777 (diff)
* file.c (rb_file_s_rename): avoid Cygwin's bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@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 c9ded87e3f..45b6790880 100644
--- a/file.c
+++ b/file.c
@@ -1170,8 +1170,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);
}