diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-19 02:29:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-19 02:29:18 +0000 |
commit | f1e332beb5047e5c91e0098606eef7d90830f35e (patch) | |
tree | 44cd6edef05803aca68f583d991b4139f8f9ace0 /file.c | |
parent | 91b1bb609ece3df1f6e2b4fc6172b87bb8b55284 (diff) |
* file.c (rb_file_s_rename): use errno if set properly.
fixed: [ruby-dev:29293]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -2232,10 +2232,16 @@ rb_file_s_rename(klass, from, to) src = StringValueCStr(from); dst = StringValueCStr(to); +#if defined __CYGWIN__ + errno = 0; +#endif if (rename(src, dst) < 0) { #if defined __CYGWIN__ extern unsigned long __attribute__((stdcall)) GetLastError(void); - errno = GetLastError(); /* This is a Cygwin bug */ + 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 (__EMX__) |