summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2014-07-16 00:54:30 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-16 13:05:21 -0700
commit2569d23915471f1727e5945c513b8be299eefa0c (patch)
treeb033eea787a74a0c815a84a53d6bec25196cb901
parentdaa22c6f8da466bd7a438f1bc27375fd737ffcf3 (diff)
downloadgit-kb/avoid-fchmod-for-now.tar.gz
config: use chmod() instead of fchmod()kb/avoid-fchmod-for-now
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>
-rw-r--r--config.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/config.c b/config.c
index 62de69e148..9c01c21ce7 100644
--- a/config.c
+++ b/config.c
@@ -1634,8 +1634,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;
@@ -1813,8 +1813,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;
}