diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-06-13 13:47:09 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-13 13:47:09 -0700 |
commit | b9a7d55d938a81eb6268196b789d573437492100 (patch) | |
tree | 637c6e3452e5b81394faf99f0a4a24ce73c801e8 /config.c | |
parent | 9743f18f3fef0b77b8715cba256a740a7238f761 (diff) | |
parent | e5b313442ab7c700d0851e9dbe7d2b029e3893e5 (diff) | |
download | git-b9a7d55d938a81eb6268196b789d573437492100.tar.gz |
Merge branch 'nd/fopen-errors'
We often try to open a file for reading whose existence is
optional, and silently ignore errors from open/fopen; report such
errors if they are not due to missing files.
* nd/fopen-errors:
mingw_fopen: report ENOENT for invalid file names
mingw: verify that paths are not mistaken for remote nicknames
log: fix memory leak in open_next_file()
rerere.c: move error_errno() closer to the source system call
print errno when reporting a system call error
wrapper.c: make warn_on_inaccessible() static
wrapper.c: add and use fopen_or_warn()
wrapper.c: add and use warn_on_fopen_errors()
config.mak.uname: set FREAD_READS_DIRECTORIES for Darwin, too
config.mak.uname: set FREAD_READS_DIRECTORIES for Linux and FreeBSD
clone: use xfopen() instead of fopen()
use xfopen() in more places
git_fopen: fix a sparse 'not declared' warning
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1438,7 +1438,7 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data) int ret = -1; FILE *f; - f = fopen(filename, "r"); + f = fopen_or_warn(filename, "r"); if (f) { flockfile(f); ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename, filename, f, data); @@ -2656,6 +2656,9 @@ int git_config_rename_section_in_file(const char *config_filename, } if (!(config_file = fopen(config_filename, "rb"))) { + ret = warn_on_fopen_errors(config_filename); + if (ret) + goto out; /* no config file means nothing to rename, no error */ goto commit_and_out; } |