summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccache.c1
-rw-r--r--manifest.c1
-rw-r--r--util.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/ccache.c b/ccache.c
index 5b8a7460..a2660ad5 100644
--- a/ccache.c
+++ b/ccache.c
@@ -661,6 +661,7 @@ static void to_cache(ARGS *args)
char *tmp_stderr2;
x_asprintf(&tmp_stderr2, "%s.tmp.stderr2.%s", cached_obj, tmp_string());
+ unlink(tmp_stderr2);
if (rename(tmp_stderr, tmp_stderr2)) {
cc_log("Failed to rename %s to %s", tmp_stderr, tmp_stderr2);
failed();
diff --git a/manifest.c b/manifest.c
index 4ba19c77..c759f1cb 100644
--- a/manifest.c
+++ b/manifest.c
@@ -673,6 +673,7 @@ int manifest_put(const char *manifest_path, struct file_hash *object_hash,
add_object_entry(mf, object_hash, included_files);
if (write_manifest(f2, mf)) {
+ unlink(manifest_path);
if (rename(tmp_file, manifest_path) == 0) {
ret = 1;
} else {
diff --git a/util.c b/util.c
index 6f7c781d..d02f16bb 100644
--- a/util.c
+++ b/util.c
@@ -329,6 +329,7 @@ move_uncompressed_file(const char *src, const char *dest, int compress_dest)
if (compress_dest) {
return move_file(src, dest, compress_dest);
} else {
+ unlink(dest);
return rename(src, dest);
}
}