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
This commit is contained in:
7
bisect.c
7
bisect.c
@ -438,10 +438,7 @@ static void read_bisect_paths(struct argv_array *array)
|
||||
{
|
||||
struct strbuf str = STRBUF_INIT;
|
||||
const char *filename = git_path_bisect_names();
|
||||
FILE *fp = fopen(filename, "r");
|
||||
|
||||
if (!fp)
|
||||
die_errno(_("Could not open file '%s'"), filename);
|
||||
FILE *fp = xfopen(filename, "r");
|
||||
|
||||
while (strbuf_getline_lf(&str, fp) != EOF) {
|
||||
strbuf_trim(&str);
|
||||
@ -669,7 +666,7 @@ static int is_expected_rev(const struct object_id *oid)
|
||||
if (stat(filename, &st) || !S_ISREG(st.st_mode))
|
||||
return 0;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
fp = fopen_or_warn(filename, "r");
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user