summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-05-03 10:16:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-26 03:33:55 (GMT)
commit23a9e0712d76a63c5af1caeb816943f466f0300e (patch)
tree1b065a078058d664ed353f6da0c77842381a5645 /builtin/am.c
parentb0a642ac4624740187212aecec62b35a2eab38cb (diff)
downloadgit-23a9e0712d76a63c5af1caeb816943f466f0300e.zip
git-23a9e0712d76a63c5af1caeb816943f466f0300e.tar.gz
git-23a9e0712d76a63c5af1caeb816943f466f0300e.tar.bz2
use xfopen() in more places
xfopen() - provides error details - explains error on reading, or writing, or whatever operation - has l10n support - prints file name in the error Some of these are missing in the places that are replaced with xfopen(), which is a clear win. In some other places, it's just less code (not as clearly a win as the previous case but still is). The only slight regresssion is in remote-testsvn, where we don't report the file class (marks files) in the error messages anymore. But since this is a _test_ svn remote transport, I'm not too concerned. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/builtin/am.c b/builtin/am.c
index a95dd8b..f5dac77 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1275,12 +1275,8 @@ static int parse_mail(struct am_state *state, const char *mail)
die("BUG: invalid value for state->scissors");
}
- mi.input = fopen(mail, "r");
- if (!mi.input)
- die("could not open input");
- mi.output = fopen(am_path(state, "info"), "w");
- if (!mi.output)
- die("could not open output 'info'");
+ mi.input = xfopen(mail, "r");
+ mi.output = xfopen(am_path(state, "info"), "w");
if (mailinfo(&mi, am_path(state, "msg"), am_path(state, "patch")))
die("could not parse patch");