Skip to content

Commit 2569d23

Browse files
kbleesgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent daa22c6 commit 2569d23

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

config.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,8 +1634,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
16341634
MAP_PRIVATE, in_fd, 0);
16351635
close(in_fd);
16361636

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",
16391639
lock->filename, strerror(errno));
16401640
ret = CONFIG_NO_WRITE;
16411641
goto out_free;
@@ -1813,8 +1813,8 @@ int git_config_rename_section_in_file(const char *config_filename,
18131813

18141814
fstat(fileno(config_file), &st);
18151815

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",
18181818
lock->filename, strerror(errno));
18191819
goto out;
18201820
}

0 commit comments

Comments
 (0)