diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b1a1da262..fe01e9d8c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index ccf5848ca..98a8848cf 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -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++) |