summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-05-03 17:16:50 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-05-26 12:33:56 +0900
commite9d983f116c7de43f40a49aae60ebfe107f153ec (patch)
tree2d1b2b10e651eb3dd941a10379719c9abd8ef993 /commit.c
parentwrapper.c: add and use warn_on_fopen_errors() (diff)
downloadtgif-e9d983f116c7de43f40a49aae60ebfe107f153ec.tar.xz
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 'commit.c')
-rw-r--r--commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 73c78c2b80..3eeda081f9 100644
--- a/commit.c
+++ b/commit.c
@@ -167,7 +167,7 @@ bad_graft_data:
static int read_graft_file(const char *graft_file)
{
- FILE *fp = fopen(graft_file, "r");
+ FILE *fp = fopen_or_warn(graft_file, "r");
struct strbuf buf = STRBUF_INIT;
if (!fp)
return -1;