Refactor, use new re-entrant svc_iterator1() API

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-18 00:21:07 +01:00
parent bf004d9ec4
commit 7f04382eee
4 changed files with 45 additions and 25 deletions
+2 -1
View File
@@ -95,13 +95,14 @@ static void pidfile_callback(void *arg, int fd, int events)
static void pidfile_reconf(void *arg)
{
static char cond[MAX_COND_LEN];
int pos;
svc_t *svc;
int restart = 0;
do {
restart = 0;
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
for (svc = svc_iterator1(&pos, 1); svc; svc = svc_iterator1(&pos, 0)) {
mkcond(cond, sizeof(cond), svc->cmd);
if (svc->state == SVC_RUNNING_STATE &&
!svc_is_changed(svc) &&