summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-22 05:33:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-22 05:33:54 +0000
commit692349734c91d214effa8ebc446c4f128e0fe098 (patch)
tree02f34d7e3a591186505dfe5d8ce2c89c878ce93a /file.c
parent414ac300d602927a605327ddaf0fab36ab4f5d21 (diff)
downloadruby-692349734c91d214effa8ebc446c4f128e0fe098.tar.gz
ruby-692349734c91d214effa8ebc446c4f128e0fe098.tar.xz
ruby-692349734c91d214effa8ebc446c4f128e0fe098.zip
* file.c (rb_file_s_rename): deleted code to get rid of a bug of
old Cygwin. * file.c (rb_file_truncate): added prototype of GetLastError() on cygwin. [ruby-dev:31239] * include/ruby/intern.h (is_ruby_native_thread): prototype. * missing/strftime.c (strftime): fix printf format and actual arguments. * ext/Win32API/Win32API.c (Win32API_initialize): ditto. * ext/tk/tcltklib.c (ip_finalize): ditto. * ext/win32ole/win32ole.c (lcid_installed): ditto. * ext/socket/getnameinfo.c: include stdio.h always. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/file.c b/file.c
index ed682a0b8..ff0c324e2 100644
--- a/file.c
+++ b/file.c
@@ -2214,18 +2214,12 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE 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)
@@ -3088,6 +3082,7 @@ rb_file_truncate(VALUE obj, VALUE len)
#ifdef __CYGWIN__
#include <winerror.h>
+extern unsigned long __attribute__((stdcall)) GetLastError(void);
#endif
static VALUE