1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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/trunk@10747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-08-19 02:29:18 +00:00
parent 34deabcbac
commit f50c13da99
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sat Aug 19 11:28:08 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_file_s_rename): use errno if set properly.
fixed: [ruby-dev:29293]
Fri Aug 18 01:05:57 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Aug 18 01:05:57 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi.rb (CGI::out): specify -m0 to disable MIME decode. a * lib/cgi.rb (CGI::out): specify -m0 to disable MIME decode. a

8
file.c
View file

@ -2180,10 +2180,16 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
FilePathValue(to); FilePathValue(to);
src = StringValueCStr(from); src = StringValueCStr(from);
dst = StringValueCStr(to); dst = StringValueCStr(to);
#if defined __CYGWIN__
errno = 0;
#endif
if (rename(src, dst) < 0) { if (rename(src, dst) < 0) {
#if defined __CYGWIN__ #if defined __CYGWIN__
extern unsigned long __attribute__((stdcall)) GetLastError(void); 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 #elif defined DOSISH && !defined _WIN32
if (errno == EEXIST if (errno == EEXIST
#if defined (__EMX__) #if defined (__EMX__)