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>
This commit is contained in:

committed by
Junio C Hamano

parent
b0a642ac46
commit
23a9e0712d
@ -337,8 +337,7 @@ static void get_merge_heads(struct oid_array *merge_heads)
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
struct object_id oid;
|
||||
|
||||
if (!(fp = fopen(filename, "r")))
|
||||
die_errno(_("could not open '%s' for reading"), filename);
|
||||
fp = xfopen(filename, "r");
|
||||
while (strbuf_getline_lf(&sb, fp) != EOF) {
|
||||
if (get_oid_hex(sb.buf, &oid))
|
||||
continue; /* invalid line: does not start with SHA1 */
|
||||
|
Reference in New Issue
Block a user