summaryrefslogtreecommitdiff
path: root/remote-testsvn.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-05-03 17:16:46 +0700
committerJunio C Hamano <gitster@pobox.com>2017-05-26 12:33:55 +0900
commit23a9e0712d76a63c5af1caeb816943f466f0300e (patch)
tree1b065a078058d664ed353f6da0c77842381a5645 /remote-testsvn.c
parentb0a642ac4624740187212aecec62b35a2eab38cb (diff)
downloadgit-23a9e0712d76a63c5af1caeb816943f466f0300e.tar.gz
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 'remote-testsvn.c')
-rw-r--r--remote-testsvn.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/remote-testsvn.c b/remote-testsvn.c
index f87bf851ba..50404ef343 100644
--- a/remote-testsvn.c
+++ b/remote-testsvn.c
@@ -124,10 +124,8 @@ static int note2mark_cb(const unsigned char *object_sha1,
static void regenerate_marks(void)
{
int ret;
- FILE *marksfile = fopen(marksfilename, "w+");
+ FILE *marksfile = xfopen(marksfilename, "w+");
- if (!marksfile)
- die_errno("Couldn't create mark file %s.", marksfilename);
ret = for_each_note(NULL, 0, note2mark_cb, marksfile);
if (ret)
die("Regeneration of marks failed, returned %d.", ret);
@@ -148,9 +146,7 @@ static void check_or_regenerate_marks(int latestrev)
marksfile = fopen(marksfilename, "r");
if (!marksfile) {
regenerate_marks();
- marksfile = fopen(marksfilename, "r");
- if (!marksfile)
- die_errno("cannot read marks file %s!", marksfilename);
+ marksfile = xfopen(marksfilename, "r");
fclose(marksfile);
} else {
strbuf_addf(&sb, ":%d ", latestrev);