Dylan Smith : makedep: Handle non-overwriting rename for Windows.

Alexandre Julliard julliard at winehq.org
Mon Aug 24 10:08:43 CDT 2009


Module: wine
Branch: master
Commit: 8e0b17462b2524ad1583d81597435517b8b1856e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8e0b17462b2524ad1583d81597435517b8b1856e

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Sat Aug 22 01:57:47 2009 -0400

makedep: Handle non-overwriting rename for Windows.

---

 tools/makedep.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index e2ca5ad..60278a9 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -960,7 +960,14 @@ static void output_dependencies(void)
 
     if (tmp_name)
     {
-        if (rename( tmp_name, OutputFileName ) == -1)
+        int ret = rename( tmp_name, OutputFileName );
+        if (ret == -1 && errno == EEXIST)
+        {
+            /* rename doesn't overwrite on windows */
+            unlink( OutputFileName );
+            ret = rename( tmp_name, OutputFileName );
+        }
+        if (ret == -1)
         {
             unlink( tmp_name );
             fatal_error( "failed to rename output file to '%s'\n", OutputFileName );




More information about the wine-cvs mailing list