X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=wrapper.c;h=68739aaa3b9e9e1a1bbbd43c75c9b5c244fb6c3e;hb=59cf706b2381d99b39c4d1daf62da9eeccf0ec13;hp=b5e33e49c77bdf1d19292971b63ff5221b013f33;hpb=e5acacfb48b29e5d2c86d14b988321df086f2228;p=git.git diff --git a/wrapper.c b/wrapper.c index b5e33e49c..68739aaa3 100644 --- a/wrapper.c +++ b/wrapper.c @@ -403,6 +403,19 @@ int remove_or_warn(unsigned int mode, const char *file) return S_ISGITLINK(mode) ? rmdir_or_warn(file) : unlink_or_warn(file); } +void warn_on_inaccessible(const char *path) +{ + warning(_("unable to access '%s': %s"), path, strerror(errno)); +} + +int access_or_warn(const char *path, int mode) +{ + int ret = access(path, mode); + if (ret && errno != ENOENT) + warn_on_inaccessible(path); + return ret; +} + struct passwd *xgetpwuid_self(void) { struct passwd *pw;