Skip to content

Commit fb0166c

Browse files
committed
Merge branch 'kb/avoid-fchmod-for-now'
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()
2 parents 80e8575 + 2569d23 commit fb0166c

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
@@ -1636,8 +1636,8 @@ int git_config_set_multivar_in_file(const char *config_filename,
16361636
MAP_PRIVATE, in_fd, 0);
16371637
close(in_fd);
16381638

1639-
if (fchmod(fd, st.st_mode & 07777) < 0) {
1640-
error("fchmod on %s failed: %s",
1639+
if (chmod(lock->filename, st.st_mode & 07777) < 0) {
1640+
error("chmod on %s failed: %s",
16411641
lock->filename, strerror(errno));
16421642
ret = CONFIG_NO_WRITE;
16431643
goto out_free;
@@ -1815,8 +1815,8 @@ int git_config_rename_section_in_file(const char *config_filename,
18151815

18161816
fstat(fileno(config_file), &st);
18171817

1818-
if (fchmod(out_fd, st.st_mode & 07777) < 0) {
1819-
ret = error("fchmod on %s failed: %s",
1818+
if (chmod(lock->filename, st.st_mode & 07777) < 0) {
1819+
ret = error("chmod on %s failed: %s",
18201820
lock->filename, strerror(errno));
18211821
goto out;
18221822
}

0 commit comments

Comments
 (0)