X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fcondition.c;h=9f2574c2f62d7d06728c2a45e18f72fab48a61a5;hb=30ab6a0fc1bb950c4dcd90dcd3dfe00a810c7fc1;hp=dcbf9a7e86a52f2ef089339550b6da4f02eba41f;hpb=2822da4fb7f891e5320f02f1d00f64b72221ced4;p=elogind.git diff --git a/src/shared/condition.c b/src/shared/condition.c index dcbf9a7e8..9f2574c2f 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -23,23 +23,21 @@ #include #include #include -#include #include #include "sd-id128.h" #include "util.h" #include "virt.h" #include "path-util.h" -#include "fileio.h" -#include "unit.h" #include "architecture.h" #include "smack-util.h" #include "apparmor-util.h" #include "ima-util.h" #include "selinux-util.h" #include "audit.h" -#include "condition.h" #include "cap-list.h" +#include "hostname-util.h" +#include "condition.h" Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) { Condition *c; @@ -47,7 +45,7 @@ Condition* condition_new(ConditionType type, const char *parameter, bool trigger assert(type >= 0); assert(type < _CONDITION_TYPE_MAX); - assert(!parameter == (type == CONDITION_NULL)); + assert((!parameter) == (type == CONDITION_NULL)); c = new0(Condition, 1); if (!c) @@ -73,11 +71,13 @@ void condition_free(Condition *c) { free(c); } -void condition_free_list(Condition *first) { +Condition* condition_free_list(Condition *first) { Condition *c, *n; LIST_FOREACH_SAFE(conditions, c, n, first) condition_free(c); + + return NULL; } static int condition_test_kernel_command_line(Condition *c) { @@ -101,7 +101,7 @@ static int condition_test_kernel_command_line(Condition *c) { _cleanup_free_ char *word = NULL; bool found; - r = unquote_first_word(&p, &word, true); + r = unquote_first_word(&p, &word, UNQUOTE_RELAX); if (r < 0) return r; if (r == 0) @@ -287,7 +287,7 @@ static int condition_test_needs_update(Condition *c) { if (!path_is_absolute(c->parameter)) return true; - p = strappenda(c->parameter, "/.updated"); + p = strjoina(c->parameter, "/.updated"); if (lstat(p, &other) < 0) return true;