summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-03-27 23:14:39 -0700
committerJunio C Hamano <gitster@pobox.com>2009-03-28 08:01:21 -0700
commit3be1f18e1b15c28ac6c750ff1a42576fd981d0f5 (patch)
tree934849257071ebf9506cc6151e4ac5f2df8246a5
parentfb8b193670b0c11d118185332efc899d6d01d5f4 (diff)
downloadgit-3be1f18e1b15c28ac6c750ff1a42576fd981d0f5.tar.gz
move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
Now move_temp_to_file() is responsible for doing everything that is necessary to turn a tempfile in $GIT_DIR into its final form, it must make sure "Coda hack" codepath correctly makes the file read-only. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sha1_file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 3bd20e715b..6f278593e5 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2263,12 +2263,12 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
*
* The same holds for FAT formatted media.
*
- * When this succeeds, we just return 0. We have nothing
+ * When this succeeds, we just return. We have nothing
* left to unlink.
*/
if (ret && ret != EEXIST) {
if (!rename(tmpfile, filename))
- return 0;
+ goto out;
ret = errno;
}
unlink(tmpfile);
@@ -2279,6 +2279,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
/* FIXME!!! Collision check here ? */
}
+out:
if (chmod(filename, 0444) || adjust_shared_perm(filename))
return error("unable to set permission to '%s'", filename);
return 0;