diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2004-02-16 11:45:04 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2004-02-16 11:45:04 +0000 |
commit | 212592dcc9ee1e0be260ea677cf57b378fbaa7e7 (patch) | |
tree | 729331de4938ba4c76461988073d023ff656830d /winsup/cygwin/syscalls.cc | |
parent | 04dbc76ea5a0fe9c54c731ef851e69505e8b8b4e (diff) | |
download | cygnal-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.tar.gz cygnal-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.tar.bz2 cygnal-212592dcc9ee1e0be260ea677cf57b378fbaa7e7.zip |
* syscalls.cc (rename): Do not test the MoveFile error code
where MoveFileEx exists.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 10 |
1 files changed, 4 insertions, 6 deletions
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++) |