From 11e50b2736f374f1608e0c5690405be1a74aa16d Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 21 Aug 2012 02:31:52 -0400 Subject: [PATCH] attr: warn on inaccessible attribute files Just like config and gitignore files, we silently ignore missing or inaccessible attribute files. An existent but inaccessible file is probably a configuration error, so let's warn the user. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- attr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/attr.c b/attr.c index b52efb55a..cab01b8b5 100644 --- a/attr.c +++ b/attr.c @@ -352,8 +352,11 @@ static struct attr_stack *read_attr_from_file(const char *path, int macro_ok) char buf[2048]; int lineno = 0; - if (!fp) + if (!fp) { + if (errno != ENOENT) + warning(_("unable to access '%s': %s"), path, strerror(errno)); return NULL; + } res = xcalloc(1, sizeof(*res)); while (fgets(buf, sizeof(buf), fp)) handle_attr_line(res, buf, path, ++lineno, macro_ok); -- 2.26.2