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:
@ -899,8 +899,8 @@ static void flush_rewritten_pending(void) {
|
||||
FILE *out;
|
||||
|
||||
if (strbuf_read_file(&buf, rebase_path_rewritten_pending(), 82) > 0 &&
|
||||
!get_sha1("HEAD", newsha1) &&
|
||||
(out = fopen(rebase_path_rewritten_list(), "a"))) {
|
||||
!get_sha1("HEAD", newsha1) &&
|
||||
(out = fopen_or_warn(rebase_path_rewritten_list(), "a"))) {
|
||||
char *bol = buf.buf, *eol;
|
||||
|
||||
while (*bol) {
|
||||
@ -919,7 +919,7 @@ static void flush_rewritten_pending(void) {
|
||||
|
||||
static void record_in_rewritten(struct object_id *oid,
|
||||
enum todo_command next_command) {
|
||||
FILE *out = fopen(rebase_path_rewritten_pending(), "a");
|
||||
FILE *out = fopen_or_warn(rebase_path_rewritten_pending(), "a");
|
||||
|
||||
if (!out)
|
||||
return;
|
||||
@ -1381,7 +1381,7 @@ static int read_populate_todo(struct todo_list *todo_list,
|
||||
|
||||
if (is_rebase_i(opts)) {
|
||||
struct todo_list done = TODO_LIST_INIT;
|
||||
FILE *f = fopen(rebase_path_msgtotal(), "w");
|
||||
FILE *f = fopen_or_warn(rebase_path_msgtotal(), "w");
|
||||
|
||||
if (strbuf_read_file(&done.buf, rebase_path_done(), 0) > 0 &&
|
||||
!parse_insn_buffer(done.buf.buf, &done))
|
||||
|
Reference in New Issue
Block a user