Do not ignore updated services when cleaning up removed ones

When cleaning up removed services, the assumption was made that if a
service was not 'removed', it was 'clean'. In reality, it could also
be 'updated', which was then overwritten, causing services not being
restarted. Don't do that.

As a future precaution, make the dirty field const, only allowing
updates from accessor methods.
This commit is contained in:
Tobias Waldekranz committed 2016-01-13 15:14:27 +01:00
1 parent 171d611b14
commit c641a1374e
4 files changed
+19 -8

No files matched your search

+13 -4
View File
@@ -352,17 +352,27 @@ void svc_mark_dynamic(void)
svc_t *svc = svc_dynamic_iterator(1);
while (svc) {
svc->dirty = -1;
*((int *)&svc->dirty) = -1;
svc = svc_dynamic_iterator(0);
}
}
void svc_mark_dirty(svc_t *svc)
{
*((int *)&svc->dirty) = 1;
}
void svc_mark_clean(svc_t *svc)
{
*((int *)&svc->dirty) = 0;
}
void svc_check_dirty(svc_t *svc, time_t mtime)
{
if (svc->mtime != mtime)
svc->dirty = 1;
svc_mark_dirty(svc);
else
svc->dirty = 0;
svc_mark_clean(svc);
svc->mtime = mtime;
}
@@ -381,7 +391,6 @@ void svc_clean_dynamic(void (*cb)(svc_t *))
if (svc->dirty == -1 && cb)
cb(svc);
svc->dirty = 0;
svc = svc_dynamic_iterator(0);
}
}