Merge branch 'kb/avoid-fchmod-for-now'
authorJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 18:18:54 +0000 (11:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 18:18:54 +0000 (11:18 -0700)
Replaces the only two uses of fchmod() with chmod() because the
former does not work on Windows port and because luckily we can.

* kb/avoid-fchmod-for-now:
config: use chmod() instead of fchmod()

config.c
index ba882a1f51de347dc52fa8c52623dbc376f36d80..9767c4bad0d0ae4af58a5f1e7f14d124d1174e10 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1636,8 +1636,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
                        MAP_PRIVATE, in_fd, 0);
                close(in_fd);
 
-               if (fchmod(fd, st.st_mode & 07777) < 0) {
-                       error("fchmod on %s failed: %s",
+               if (chmod(lock->filename, st.st_mode & 07777) < 0) {
+                       error("chmod on %s failed: %s",
                                lock->filename, strerror(errno));
                        ret = CONFIG_NO_WRITE;
                        goto out_free;
@@ -1815,8 +1815,8 @@ int git_config_rename_section_in_file(const char *config_filename,
 
        fstat(fileno(config_file), &st);
 
-       if (fchmod(out_fd, st.st_mode & 07777) < 0) {
-               ret = error("fchmod on %s failed: %s",
+       if (chmod(lock->filename, st.st_mode & 07777) < 0) {
+               ret = error("chmod on %s failed: %s",
                                lock->filename, strerror(errno));
                goto out;
        }