commit 2a57020b374709058c3f812c2672f8f367ea46fa from: Stefan Sperling date: Wed Feb 20 08:43:09 2019 UTC clean up temp files if rename(2) fails commit - 65ad4e61087e708b8ec592c0ba5fe32955fcdc65 commit + 2a57020b374709058c3f812c2672f8f367ea46fa blob - c0988d071d4854ceebaab737557de54bd5270fb3 blob + 22ee00ac8d3a6c06298d8e7c068f0d270f3c7c4a --- lib/worktree.c +++ lib/worktree.c @@ -115,6 +115,7 @@ update_meta_file(const char *path_got, const char *nam if (rename(tmppath, path) != 0) { err = got_error_from_errno(); + unlink(tmppath); goto done; } @@ -794,6 +795,7 @@ merge_blob(struct got_worktree *worktree, struct got_f if (rename(merged_path, ondisk_path) != 0) { err = got_error_from_errno(); + unlink(merged_path); goto done; } @@ -905,6 +907,7 @@ install_blob(struct got_worktree *worktree, struct got if (update) { if (rename(tmppath, ondisk_path) != 0) { err = got_error_from_errno(); + unlink(tmppath); goto done; } } @@ -1266,6 +1269,7 @@ got_worktree_checkout_files(struct got_worktree *workt if (rename(new_fileindex_path, fileindex_path) != 0) { err = got_error_from_errno(); + unlink(new_fileindex_path); goto done; }