diff --git a/service.c b/service.c index c4426a13..d51679a1 100644 --- a/service.c +++ b/service.c @@ -659,9 +659,9 @@ int service_register(int type, char *line, time_t mtime, char *username) return errno = ENOMEM; } } - if (svc->mtime != mtime) - svc->dirty = 1; - svc->mtime = mtime; + + /* New, recently modified or unchanged ... used on reload. */ + svc_check_dirty(svc, mtime); if (desc) strlcpy(svc->desc, desc + 3, sizeof(svc->desc)); diff --git a/svc.c b/svc.c index ba5b88f4..9da209bf 100644 --- a/svc.c +++ b/svc.c @@ -330,6 +330,15 @@ void svc_mark_dynamic(void) } } +void svc_check_dirty(svc_t *svc, time_t mtime) +{ + if (svc->mtime != mtime) + svc->dirty = 1; + else + svc->dirty = 0; + svc->mtime = mtime; +} + /** * svc_clean_dynamic - Stop and cleanup stale services removed from /etc/finit.d * @cb: Callback to run for each stale service diff --git a/svc.h b/svc.h index 99d28245..d2ef65c5 100644 --- a/svc.h +++ b/svc.h @@ -128,6 +128,7 @@ void svc_foreach (void (*cb)(svc_t *)); void svc_foreach_dynamic (void (*cb)(svc_t *)); void svc_mark_dynamic (void); +void svc_check_dirty (svc_t *svc, time_t mtime); void svc_clean_dynamic (void (*cb)(svc_t *)); char *svc_status (svc_t *svc);