From: Junio C Hamano Date: Wed, 26 Aug 2015 22:45:30 +0000 (-0700) Subject: Merge branch 'ss/fix-config-fd-leak' X-Git-Tag: v2.6.0-rc0~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51e83a4898b47ff3286f1cff65c3715ee803ade9;p=thirdparty%2Fgit.git Merge branch 'ss/fix-config-fd-leak' * ss/fix-config-fd-leak: config: close config file handle in case of error --- 51e83a4898b47ff3286f1cff65c3715ee803ade9 diff --cc config.c index a34b850cdc,83caa2546e..c027e6fbe0 --- a/config.c +++ b/config.c @@@ -2065,10 -2065,11 +2065,11 @@@ int git_config_set_multivar_in_file(con goto out_free; } close(in_fd); + in_fd = -1; - if (chmod(lock->filename.buf, st.st_mode & 07777) < 0) { + if (chmod(get_lock_file_path(lock), st.st_mode & 07777) < 0) { error("chmod on %s failed: %s", - lock->filename.buf, strerror(errno)); + get_lock_file_path(lock), strerror(errno)); ret = CONFIG_NO_WRITE; goto out_free; }