* syscalls.cc (rename): Do not test the MoveFile error code

where MoveFileEx exists.
This commit is contained in:
Corinna Vinschen 2004-02-16 11:45:04 +00:00
parent 04dbc76ea5
commit 212592dcc9
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2004-02-16 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (rename): Do not test the MoveFile error code
where MoveFileEx exists.
2004-02-15 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (_csbrk): Report more debugging details on failing

View File

@ -1314,20 +1314,18 @@ rename (const char *oldpath, const char *newpath)
&& (lnk_suffix = strrchr (real_new.get_win32 (), '.')))
*lnk_suffix = '\0';
if (!MoveFile (real_old, real_new))
res = -1;
if (res == 0 || (GetLastError () != ERROR_ALREADY_EXISTS
&& GetLastError () != ERROR_FILE_EXISTS))
if (MoveFile (real_old, real_new))
goto done;
res = -1;
if (wincap.has_move_file_ex ())
{
if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
MOVEFILE_REPLACE_EXISTING))
res = 0;
}
else
else if (GetLastError () == ERROR_ALREADY_EXISTS
|| GetLastError () == ERROR_FILE_EXISTS)
{
syscall_printf ("try win95 hack");
for (int i = 0; i < 2; i++)