diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-30 00:32:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-30 00:32:03 +0000 |
commit | db8874aa1b41ddcebdf79b8ad1ef736028ef45e3 (patch) | |
tree | d98988df03efd0a9f114bce9fce5e5b35e88663d /file.c | |
parent | fe13785cc699692cefbdf94908fcaa7c99672f0f (diff) |
* configure.in (os2-emx): renamed from os2_emx, add flags to
CFLAGS and LDFLAGS, and remove lib prefix. [ruby-dev:20993]
* file.c (rb_file_s_rename): retry with removing new file on
DOSISH. [ruby-dev:21007]
* ext/socket/extconf.rb (sendmsg, recvmsg): check functions.
* ext/socket/socket.c (unix_send_io, unix_recv_io): raise
NotImplementedError unless system calls are available.
* ext/socket/socket.c (sock_initialize): rename from sock_init()
to get rid of conflict with OS/2 socket library.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1333,13 +1333,27 @@ static VALUE rb_file_s_rename(klass, from, to) VALUE klass, from, to; { + const char *src, *dst; SafeStringValue(from); SafeStringValue(to); - if (rename(StringValueCStr(from), StringValueCStr(to)) < 0) { + src = StringValueCStr(from); + dst = StringValueCStr(to); + if (rename(src, dst) < 0) { #if defined __CYGWIN__ extern unsigned long __attribute__((stdcall)) GetLastError(); errno = GetLastError(); /* This is a Cygwin bug */ +#elif defined DOSISH && !defined _WIN32 + if (errno == EEXIST +#if defined (__EMX__) + || errno == EACCES +#endif + ) { + if (chmod(dst, 0666) == 0 && + unlink(dst) == 0 && + rename(src, dst) == 0) + return INT2FIX(0); + } #endif sys_fail2(from, to); } |