builtin/am.c: use error_errno()

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nguyễn Thái Ngọc Duy 2016-05-08 16:47:24 +07:00 committed by Junio C Hamano
parent 23e7a312e1
commit 6e59e9c0a6
1 changed files with 5 additions and 6 deletions

View File

@ -769,15 +769,15 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state,
in = fopen(*paths, "r"); in = fopen(*paths, "r");


if (!in) if (!in)
return error(_("could not open '%s' for reading: %s"), return error_errno(_("could not open '%s' for reading"),
*paths, strerror(errno)); *paths);


mail = mkpath("%s/%0*d", state->dir, state->prec, i + 1); mail = mkpath("%s/%0*d", state->dir, state->prec, i + 1);


out = fopen(mail, "w"); out = fopen(mail, "w");
if (!out) if (!out)
return error(_("could not open '%s' for writing: %s"), return error_errno(_("could not open '%s' for writing"),
mail, strerror(errno)); mail);


ret = fn(out, in, keep_cr); ret = fn(out, in, keep_cr);


@ -857,8 +857,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,


fp = fopen(*paths, "r"); fp = fopen(*paths, "r");
if (!fp) if (!fp)
return error(_("could not open '%s' for reading: %s"), *paths, return error_errno(_("could not open '%s' for reading"), *paths);
strerror(errno));


while (!strbuf_getline_lf(&sb, fp)) { while (!strbuf_getline_lf(&sb, fp)) {
if (*sb.buf == '#') if (*sb.buf == '#')