diff --git a/src/svc.c b/src/svc.c index 0a9b6dd4..f771a3ed 100644 --- a/src/svc.c +++ b/src/svc.c @@ -307,20 +307,19 @@ void svc_foreach_type(int types, void (*cb)(svc_t *)) * svc_stop_completed - Have all stopped services been collected? * * Returns: - * 1, if all stopped services have been collected. 0 otherwise. + * %NULL if all stopped services have been collected, otherwise a + * pointer to the first svc_t waiting to be collected. */ -int svc_stop_completed(void) +svc_t *svc_stop_completed(void) { svc_t *svc; for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) { - if (svc->state == SVC_STOPPING_STATE) { - _e("Waiting to collect %s(%d) ...", svc->cmd, svc->pid); - return 0; - } + if (svc->state == SVC_STOPPING_STATE) + return svc; } - return 1; + return NULL; } /** diff --git a/src/svc.h b/src/svc.h index ec620350..dfe141e6 100644 --- a/src/svc.h +++ b/src/svc.h @@ -158,7 +158,7 @@ void svc_foreach (void (*cb)(svc_t *)); void svc_foreach_dynamic (void (*cb)(svc_t *)); void svc_foreach_type (int types, void (*cb)(svc_t *)); -int svc_stop_completed (void); +svc_t *svc_stop_completed (void); void svc_mark_dynamic (void); void svc_check_dirty (svc_t *svc, struct timeval *mtime);