Skip to content

Commit

Permalink
* file.c (rb_file_s_rename): use errno if set properly.
Browse files Browse the repository at this point in the history
  fixed: [ruby-dev:29293]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Aug 19, 2006
1 parent 34deabc commit f50c13d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Sat Aug 19 11:28:08 2006 Nobuyoshi Nakada <[email protected]>

* file.c (rb_file_s_rename): use errno if set properly.
fixed: [ruby-dev:29293]

Fri Aug 18 01:05:57 2006 Yukihiro Matsumoto <[email protected]>

* lib/cgi.rb (CGI::out): specify -m0 to disable MIME decode. a
Expand Down
8 changes: 7 additions & 1 deletion file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2180,10 +2180,16 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
FilePathValue(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__)
Expand Down

0 comments on commit f50c13d

Please sign in to comment.