aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-02-16 11:45:04 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-02-16 11:45:04 +0000
commit212592dcc9ee1e0be260ea677cf57b378fbaa7e7 (patch)
tree729331de4938ba4c76461988073d023ff656830d
parent04dbc76ea5a0fe9c54c731ef851e69505e8b8b4e (diff)
downloadnewlib-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.zip
newlib-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.tar.gz
newlib-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.tar.bz2
* syscalls.cc (rename): Do not test the MoveFile error code
where MoveFileEx exists.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/syscalls.cc10
2 files changed, 9 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b1a1da2..fe01e9d 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 ccf5848..98a8848 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++)