condition: always follow symlinks for condition checks, to mimic test

This commit is contained in:
Lennart Poettering 2011-09-21 01:07:25 +02:00
parent db01f8b3f8
commit 8571962ca3
2 changed files with 7 additions and 7 deletions

View file

@ -691,7 +691,7 @@
is prefixed with an exclamation mark is prefixed with an exclamation mark
(!), the test is negated, and the unit (!), the test is negated, and the unit
is only started if the path does not is only started if the path does not
exist. The test follows symlinks. exist.
<varname>ConditionPathExistsGlob=</varname> <varname>ConditionPathExistsGlob=</varname>
works in a similar way, but checks for works in a similar way, but checks for
the existence of at least one file or the existence of at least one file or
@ -701,9 +701,8 @@
is similar to is similar to
<varname>ConditionPathExists=</varname> <varname>ConditionPathExists=</varname>
but verifies whether a certain path but verifies whether a certain path
exists and is a directory. It does not exists and is a
follow directory. <varname>ConditionPathIsMountPoint=</varname>
symlinks. <varname>ConditionPathIsMountPoint=</varname>
is similar to is similar to
<varname>ConditionPathExists=</varname> <varname>ConditionPathExists=</varname>
but verifies whether a certain path but verifies whether a certain path
@ -713,7 +712,7 @@
<varname>ConditionPathExists=</varname> <varname>ConditionPathExists=</varname>
but verifies whether a certain path but verifies whether a certain path
exists, is a regular file and marked exists, is a regular file and marked
executable. It follows symlinks. executable.
<varname>ConditionDirectoryNotEmpty=</varname> <varname>ConditionDirectoryNotEmpty=</varname>
is similar to is similar to
<varname>ConditionPathExists=</varname> <varname>ConditionPathExists=</varname>
@ -781,7 +780,8 @@
prefix an argument with the pipe prefix an argument with the pipe
symbol and an exclamation mark the symbol and an exclamation mark the
pipe symbol must be passed first, the pipe symbol must be passed first, the
exclamation second.</para></listitem> exclamation second. All path checks
follow symlinks.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View file

@ -162,7 +162,7 @@ bool condition_test(Condition *c) {
case CONDITION_PATH_IS_DIRECTORY: { case CONDITION_PATH_IS_DIRECTORY: {
struct stat st; struct stat st;
if (lstat(c->parameter, &st) < 0) if (stat(c->parameter, &st) < 0)
return !c->negate; return !c->negate;
return S_ISDIR(st.st_mode) == !c->negate; return S_ISDIR(st.st_mode) == !c->negate;
} }