chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemd,systemctl: export condition status and show failing condition
[elogind.git]
/
src
/
core
/
condition.c
diff --git
a/src/core/condition.c
b/src/core/condition.c
index 2fbc5ad0e6914534ca2173c3fd06b7f1ab751266..6c387450afdd5d2aea3d7798a55e17e0de3e5db7 100644
(file)
--- a/
src/core/condition.c
+++ b/
src/core/condition.c
@@
-250,7
+250,7
@@
static bool test_ac_power(const char *parameter) {
return (on_ac_power() != 0) == !!r;
}
return (on_ac_power() != 0) == !!r;
}
-bool condition_test(Condition *c) {
+
static
bool condition_test(Condition *c) {
assert(c);
switch(c->type) {
assert(c);
switch(c->type) {
@@
-358,6
+358,7
@@
bool condition_test_list(const char *unit, Condition *first) {
c->parameter,
b ? "succeeded" : "failed",
unit);
c->parameter,
b ? "succeeded" : "failed",
unit);
+ c->state = b ? 1 : -1;
if (!c->trigger && !b)
return false;
if (!c->trigger && !b)
return false;
@@
-377,12
+378,13
@@
void condition_dump(Condition *c, FILE *f, const char *prefix) {
prefix = "";
fprintf(f,
prefix = "";
fprintf(f,
- "%s\t%s: %s%s%s\n",
+ "%s\t%s: %s%s%s
%s
\n",
prefix,
condition_type_to_string(c->type),
c->trigger ? "|" : "",
c->negate ? "!" : "",
prefix,
condition_type_to_string(c->type),
c->trigger ? "|" : "",
c->negate ? "!" : "",
- c->parameter);
+ c->parameter,
+ c->state < 0 ? "failed" : c->state > 0 ? "succeeded" : "untested");
}
void condition_dump_list(Condition *first, FILE *f, const char *prefix) {
}
void condition_dump_list(Condition *first, FILE *f, const char *prefix) {