summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-07 06:11:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-07 06:11:16 (GMT)
commit4f43e9726af5d036af96de9e5208a6122d378f9b (patch)
treef50d3e8b91afe0ee2f45430639c2d6947d5ce651 /wrapper.c
parent1965f8cdbdf86930b99fd61ed2efb22ac3d6a725 (diff)
parent8f2bbe452e2c2917ec3c9a5d1593f26908cab83b (diff)
downloadgit-4f43e9726af5d036af96de9e5208a6122d378f9b.zip
git-4f43e9726af5d036af96de9e5208a6122d378f9b.tar.gz
git-4f43e9726af5d036af96de9e5208a6122d378f9b.tar.bz2
Merge branch 'jn/warn-on-inaccessible-loosen'
Deal with a situation where .config/git is a file and we notice .config/git/config is not readable due to ENOTDIR, not ENOENT. * jn/warn-on-inaccessible-loosen: config: exit on error accessing any config file doc: advertise GIT_CONFIG_NOSYSTEM config: treat user and xdg config permission problems as errors config, gitignore: failure to access with ENOTDIR is ok
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/wrapper.c b/wrapper.c
index a066e2e..bac59d2 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -411,11 +411,19 @@ void warn_on_inaccessible(const char *path)
int access_or_warn(const char *path, int mode)
{
int ret = access(path, mode);
- if (ret && errno != ENOENT)
+ if (ret && errno != ENOENT && errno != ENOTDIR)
warn_on_inaccessible(path);
return ret;
}
+int access_or_die(const char *path, int mode)
+{
+ int ret = access(path, mode);
+ if (ret && errno != ENOENT && errno != ENOTDIR)
+ die_errno(_("unable to access '%s'"), path);
+ return ret;
+}
+
struct passwd *xgetpwuid_self(void)
{
struct passwd *pw;