From 44019f6542885fd684c5113c7a5c06308a51102a Mon Sep 17 00:00:00 2001 From: Christian Ruppert Date: Thu, 26 Jan 2012 20:44:33 +0100 Subject: Add is_writable() function to check whether a path is writable or not --- src/rc/rc-misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/rc') diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index a06ff088..27397d71 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -331,3 +331,12 @@ parse_mode(mode_t *mode, char *text) errno = EINVAL; return -1; } + +int +is_writable(const char *path) +{ + if (access(path, W_OK) == 0) + return 1; + + return 0; +} -- cgit v1.2.3