summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--initd/supervisor.c8
-rw-r--r--lib/include/service.h1
2 files changed, 4 insertions, 5 deletions
diff --git a/initd/supervisor.c b/initd/supervisor.c
index 3f157bf..a11c6b8 100644
--- a/initd/supervisor.c
+++ b/initd/supervisor.c
@@ -82,9 +82,9 @@ static void handle_terminated_service(service_t *svc)
break;
if (svc->rspwn_limit > 0) {
- svc->rspwn_limit -= 1;
+ svc->rspwn_count += 1;
- if (svc->rspwn_limit == 0) {
+ if (svc->rspwn_count >= svc->rspwn_limit) {
print_status(svc->desc, STATUS_FAIL, false);
goto out_failure;
}
@@ -319,9 +319,7 @@ void supervisor_start(int id)
}
return;
found:
- if (svc->type == SVC_RESPAWN)
- svc->rspwn_limit = 0;
-
+ svc->rspwn_count = 0;
svc->flags &= ~SVC_FLAG_ADMIN_STOPPED;
svc->next = queue;
queue = svc;
diff --git a/lib/include/service.h b/lib/include/service.h
index 4e8f0b3..3cb799a 100644
--- a/lib/include/service.h
+++ b/lib/include/service.h
@@ -56,6 +56,7 @@ typedef struct service_t {
char *desc; /* description string */
char *ctty; /* controlling tty or log file */
int rspwn_limit; /* maximum respawn count */
+ int rspwn_count; /* services respawn counter */
unsigned int flags; /* SVC_FLAG_* bit field */
/* linked list of command lines to execute */