This problem doesn't happen on LFN systems (Windows 9X), because
the code in that case opens OLD and tries to remove it (actually it
tries to remove NEW, but they are the same) while OLD is still open.
And Windows 9X doesn't allow such crimes against humanity.
This is corrected in WIP and will be in v2.03. Here's the patch:
*** src/libc/ansi/stdio/_rename.c.~1~ Sun Jul 12 18:29:22 1998
--- src/libc/ansi/stdio/_rename.c Thu Apr 15 18:35:44 1999
***************
*** 7,12 ****
--- 7,13 ----
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
+ #include <sys/stat.h>
#include <io.h>
#include <dos.h>
#include <go32.h>
***************
*** 19,28 ****
int olen = strlen(old) + 1;
int i;
int use_lfn = _USE_LFN;
! char tempfile[FILENAME_MAX];
const char *orig = old;
int lfn_fd = -1;
r.x.dx = __tb_offset;
r.x.di = __tb_offset + olen;
r.x.ds = r.x.es = __tb_segment;
--- 20,34 ----
int olen = strlen(old) + 1;
int i;
int use_lfn = _USE_LFN;
! char tempfile[FILENAME_MAX], tempfile1[FILENAME_MAX];
const char *orig = old;
int lfn_fd = -1;
+ /* If OLD and NEW are the same file, do nothing. */
+ if (__file_exists(new)
+ && strcmp(_truename(old, tempfile), _truename(new, tempfile1)) == 0)
+ return 0;
+
r.x.dx = __tb_offset;
r.x.di = __tb_offset + olen;
r.x.ds = r.x.es = __tb_segment;