Unit *u = data;
bool trigger, negate;
Condition *c;
+ char *p;
assert(filename);
assert(lvalue);
if (negate)
rvalue++;
- if (!path_is_absolute(rvalue)) {
- log_error("[%s:%u] Path in condition not absolute, ignoring: %s", filename, line, rvalue);
+ p = unit_full_printf(u, rvalue);
+ if (!p)
+ return -ENOMEM;
+
+ if (!path_is_absolute(p)) {
+ log_error("[%s:%u] Path in condition not absolute, ignoring: %s", filename, line, p);
return 0;
}
- c = condition_new(cond, rvalue, trigger, negate);
+ c = condition_new(cond, p, trigger, negate);
if (!c)
return -ENOMEM;
+ free(p);
LIST_PREPEND(Condition, conditions, u->conditions, c);
return 0;
Unit *u = data;
bool trigger, negate;
Condition *c;
+ char *s;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
- if ((trigger = rvalue[0] == '|'))
+ trigger = rvalue[0] == '|';
+ if (trigger)
rvalue++;
- if ((negate = rvalue[0] == '!'))
+ negate = rvalue[0] == '!';
+ if (negate)
rvalue++;
- if (!(c = condition_new(cond, rvalue, trigger, negate)))
+ s = unit_full_printf(u, rvalue);
+ if (!s)
return -ENOMEM;
+ c = condition_new(cond, s, trigger, negate);
+ if (!c)
+ return log_oom();
+ free(s);
+
LIST_PREPEND(Condition, conditions, u->conditions, c);
return 0;
}
ExecContext *c = data;
Unit *u = userdata;
- bool invert;
+ bool invert = false;
char *w;
size_t l;
char *state;