summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/wrapper.c b/wrapper.c
index b5e33e49c7..68739aaa3b 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;