summaryrefslogtreecommitdiff
path: root/src/condition.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2011-09-21 01:29:38 +0200
committerMichal Schmidt <mschmidt@redhat.com>2011-09-21 01:42:02 +0200
commit0d60602c3b4d4b65da672d75c6146f2ea4b27f88 (patch)
tree9522f11f7c3258e930196f169f8c0a062da83a20 /src/condition.c
parent8571962ca31a468959eedce26fda278587327ba5 (diff)
condition: add ConditionPathIsSymbolicLink
Diffstat (limited to 'src/condition.c')
-rw-r--r--src/condition.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/condition.c b/src/condition.c
index 7f8564966a..f84c81bd81 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -167,6 +167,14 @@ bool condition_test(Condition *c) {
return S_ISDIR(st.st_mode) == !c->negate;
}
+ case CONDITION_PATH_IS_SYMBOLIC_LINK: {
+ struct stat st;
+
+ if (lstat(c->parameter, &st) < 0)
+ return !c->negate;
+ return S_ISLNK(st.st_mode) == !c->negate;
+ }
+
case CONDITION_PATH_IS_MOUNT_POINT:
return (path_is_mount_point(c->parameter, true) > 0) == !c->negate;
@@ -256,6 +264,7 @@ static const char* const condition_type_table[_CONDITION_TYPE_MAX] = {
[CONDITION_PATH_EXISTS] = "ConditionPathExists",
[CONDITION_PATH_EXISTS_GLOB] = "ConditionPathExistsGlob",
[CONDITION_PATH_IS_DIRECTORY] = "ConditionPathIsDirectory",
+ [CONDITION_PATH_IS_SYMBOLIC_LINK] = "ConditionPathIsSymbolicLink",
[CONDITION_PATH_IS_MOUNT_POINT] = "ConditionPathIsMountPoint",
[CONDITION_DIRECTORY_NOT_EMPTY] = "ConditionDirectoryNotEmpty",
[CONDITION_KERNEL_COMMAND_LINE] = "ConditionKernelCommandLine",