summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/file.c b/file.c
index 226046a6ef..cff6b3226e 100644
--- a/file.c
+++ b/file.c
@@ -2242,18 +2242,12 @@ rb_file_s_rename(klass, from, to)
errno = 0;
#endif
if (rename(src, dst) < 0) {
-#if defined __CYGWIN__
- extern unsigned long __attribute__((stdcall)) GetLastError(void);
- if (errno == 0) { /* This is a bug of old Cygwin */
- /* incorrect as cygwin errno, but the last resort */
- errno = GetLastError();
- }
-#elif defined DOSISH && !defined _WIN32
- if (errno == EEXIST
+#if defined DOSISH && !defined _WIN32
+ switch (errno) {
+ case EEXIST:
#if defined (__EMX__)
- || errno == EACCES
+ case EACCES:
#endif
- ) {
if (chmod(dst, 0666) == 0 &&
unlink(dst) == 0 &&
rename(src, dst) == 0)
@@ -3132,8 +3126,10 @@ rb_file_truncate(obj, len)
# endif
#ifdef __CYGWIN__
-static int
#include <winerror.h>
+extern unsigned long __attribute__((stdcall)) GetLastError(void);
+
+static int
cygwin_flock(int fd, int op)
{
int old_errno = errno;