diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-05-03 17:16:50 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-26 12:33:56 +0900 |
commit | e9d983f116c7de43f40a49aae60ebfe107f153ec (patch) | |
tree | 2d1b2b10e651eb3dd941a10379719c9abd8ef993 /wt-status.c | |
parent | 11dc1fcb3fa53f5a46486daa7cb38ed387153f2e (diff) | |
download | git-e9d983f116c7de43f40a49aae60ebfe107f153ec.tar.gz |
wrapper.c: add and use fopen_or_warn()
When fopen() returns NULL, it could be because the given path does not
exist, but it could also be some other errors and the caller has to
check. Add a wrapper so we don't have to repeat the same error check
everywhere.
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 'wt-status.c')
-rw-r--r-- | wt-status.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wt-status.c b/wt-status.c index 0375484962..cdf9f5eed2 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1065,7 +1065,8 @@ static void show_am_in_progress(struct wt_status *s, static char *read_line_from_git_path(const char *filename) { struct strbuf buf = STRBUF_INIT; - FILE *fp = fopen(git_path("%s", filename), "r"); + FILE *fp = fopen_or_warn(git_path("%s", filename), "r"); + if (!fp) { strbuf_release(&buf); return NULL; |