Let cond_update() return if any svc_t was affected

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-06-06 00:33:36 +02:00
parent b82b205d92
commit cdc8873f5b
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -164,18 +164,22 @@ int cond_set_path(const char *path, enum cond_state next)
}
/* Should only be used by cond_set*(), cond_clear(), and usr/sys plugins! */
void cond_update(const char *name)
int cond_update(const char *name)
{
svc_t *svc, *iter = NULL;
int affects = 0;
_d("%s", name);
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
if (!svc_has_cond(svc) || !cond_affects(name, svc->cond))
continue;
affects++;
_d("%s: match <%s> %s(%s)", name ?: "nil", svc->cond, svc->desc, svc->cmd);
service_step(svc);
}
return affects;
}
int cond_set_noupdate(const char *name)
+1 -1
View File
@@ -30,7 +30,7 @@ enum cond_state cond_get (const char *name);
enum cond_state cond_get_agg (const char *names);
int cond_affects (const char *name, const char *names);
void cond_update (const char *name);
int cond_update (const char *name);
int cond_set_path (const char *path, enum cond_state new);
void cond_set (const char *name);
void cond_set_oneshot (const char *name);