diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-05-03 12:16:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-26 05:33:55 +0200 |
commit | 23a9e0712d76a63c5af1caeb816943f466f0300e (patch) | |
tree | 1b065a078058d664ed353f6da0c77842381a5645 /builtin/fsck.c | |
parent | git_fopen: fix a sparse 'not declared' warning (diff) | |
download | git-23a9e0712d76a63c5af1caeb816943f466f0300e.tar.xz git-23a9e0712d76a63c5af1caeb816943f466f0300e.zip |
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/fsck.c')
-rw-r--r-- | builtin/fsck.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c index b5e13a4556..00beaaa4e6 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -280,8 +280,7 @@ static void check_unreachable_object(struct object *obj) free(filename); return; } - if (!(f = fopen(filename, "w"))) - die_errno("Could not open '%s'", filename); + f = xfopen(filename, "w"); if (obj->type == OBJ_BLOB) { if (stream_blob_to_fd(fileno(f), &obj->oid, NULL, 1)) die_errno("Could not write '%s'", filename); |