summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Ziermann <b@loet.de>2015-11-27 11:03:58 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-11-27 11:58:46 +0100
commit4a350d3b3ce179ae7a543465828a071fabc345f8 (patch)
tree264298c7ee1b05bb37969b2919dca36559ac7ff9
parentcf722844440fea05c1700d1691bdaf1135e6e6ca (diff)
downloaddev86-4a350d3b3ce179ae7a543465828a071fabc345f8.tar.gz
ar: rename of temporary libary fails on some platforms
if the destination already exists, rename (tempname, archive) will fail, add unlink() first.
-rw-r--r--ar/ar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ar/ar.c b/ar/ar.c
index f808a3a..edba227 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -1052,8 +1052,11 @@ write_archive (map, appendflag)
close (outdesc);
if (!appendflag)
- if (rename (tempname, archive))
- pfatal_with_name (tempname);
+ {
+ unlink(archive);
+ if (rename (tempname, archive))
+ pfatal_with_name (tempname);
+ }
close_archive ();
}