summaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2012-01-26 20:44:33 +0100
committerChristian Ruppert <idl0r@gentoo.org>2012-01-26 20:46:31 +0100
commit44019f6542885fd684c5113c7a5c06308a51102a (patch)
tree9894e04ea8c2f3707bd0de54973d8f279451f4fe /src/rc
parentde5cee2c217e5ed606db19ca1433686048303297 (diff)
downloadopenrc-44019f6542885fd684c5113c7a5c06308a51102a.tar.gz
openrc-44019f6542885fd684c5113c7a5c06308a51102a.tar.bz2
openrc-44019f6542885fd684c5113c7a5c06308a51102a.tar.xz
Add is_writable() function to check whether a path is writable or not
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-misc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index a06ff08..27397d7 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;
+}