X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=wrapper.c;h=bac59d2c41bae7441038b30728c696b6280f4c2d;hb=d2216a4b133f90a543a0e4c4a9f9809a043012d6;hp=a066e2ee9e2cc90ad77547ee9f2267e255cf7d23;hpb=4208fa5ce44a746edb582898dfa49b2bfa84dbcc;p=git.git diff --git a/wrapper.c b/wrapper.c index a066e2ee9..bac59d2c4 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;