config: use chmod() instead of fchmod()

There is no fchmod() on native Windows platforms (MinGW and MSVC), and the equivalent Win32 API (SetFileInformationByHandle) requires Windows Vista. Use chmod() instead. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Karsten Blees committed Jul 16, 2014 at 00:54 UTC 2569d23915471f1727e5945c513b8be299eefa0c
1 file changed +4 -4
config.c
+4 -4
@@ -1634,8 +1634,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
1634 MAP_PRIVATE, in_fd, 0);
1635 close(in_fd);
1636
1637 - if (fchmod(fd, st.st_mode & 07777) < 0) {
1638 - error("fchmod on %s failed: %s",
1637 + if (chmod(lock->filename, st.st_mode & 07777) < 0) {
1638 + error("chmod on %s failed: %s",
1639 lock->filename, strerror(errno));
1640 ret = CONFIG_NO_WRITE;
1641 goto out_free;
@@ -1813,8 +1813,8 @@ int git_config_rename_section_in_file(const char *config_filename,
1813
1814 fstat(fileno(config_file), &st);
1815
1816 - if (fchmod(out_fd, st.st_mode & 07777) < 0) {
1817 - ret = error("fchmod on %s failed: %s",
1816 + if (chmod(lock->filename, st.st_mode & 07777) < 0) {
1817 + ret = error("chmod on %s failed: %s",
1818 lock->filename, strerror(errno));
1819 goto out;
1820 }