To avoid possible mistakes and to uniformly show the errno related messages, let's use error_errno() where possible. Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- apply.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apply.c b/apply.c index de86f40..2ac22d3 100644 --- a/apply.c +++ b/apply.c @@ -3512,7 +3512,7 @@ static int load_current(struct apply_state *state, ce = active_cache[pos]; if (lstat(name, &st)) { if (errno != ENOENT) - return error(_("%s: %s"), name, strerror(errno)); + return error_errno("%s", name); if (checkout_target(&the_index, ce, &st)) return -1; } @@ -3671,7 +3671,7 @@ static int check_preimage(struct apply_state *state, } else if (!state->cached) { stat_ret = lstat(old_name, st); if (stat_ret && errno != ENOENT) - return error(_("%s: %s"), old_name, strerror(errno)); + return error_errno("%s", old_name); } if (state->check_index && !previous) { @@ -3693,7 +3693,7 @@ static int check_preimage(struct apply_state *state, } else if (stat_ret < 0) { if (patch->is_new < 0) goto is_new; - return error(_("%s: %s"), old_name, strerror(errno)); + return error_errno("%s", old_name); } if (!state->cached && !previous) @@ -3752,7 +3752,7 @@ static int check_to_create(struct apply_state *state, return EXISTS_IN_WORKTREE; } else if ((errno != ENOENT) && (errno != ENOTDIR)) { - return error("%s: %s", new_name, strerror(errno)); + return error_errno("%s", new_name); } return 0; } @@ -4271,9 +4271,9 @@ static int add_index_file(struct apply_state *state, if (!state->cached) { if (lstat(path, &st) < 0) { free(ce); - return error(_("unable to stat newly " - "created file '%s': %s"), - path, strerror(errno)); + return error_errno(_("unable to stat newly " + "created file '%s'"), + path); } fill_stat_cache_info(ce, &st); } @@ -4327,7 +4327,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf, strbuf_release(&nbuf); if (close(fd) < 0 && !res) - return error(_("closing file '%s': %s"), path, strerror(errno)); + return error_errno(_("closing file '%s'"), path); return res ? -1 : 0; } @@ -4525,7 +4525,7 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch) rej = fopen(namebuf, "w"); if (!rej) - return error(_("cannot open %s: %s"), namebuf, strerror(errno)); + return error_errno(_("cannot open %s"), namebuf); /* Normal git tools never deal with .rej, so do not pretend * this is a git patch by saying --git or giving extended -- 2.9.0.172.gfb57a78 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html