Skip to content

Commit

Permalink
config: use chmod() instead of fchmod()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Karsten Blees authored and Junio C Hamano committed Jul 16, 2014
1 parent daa22c6 commit 2569d23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2569d23

Please sign in to comment.