diff options
| author | Felix Fietkau | 2025-03-13 10:21:13 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2025-03-13 10:21:15 +0000 |
| commit | 891094aefcb28a376a43b7c539f599a8e0987e4d (patch) | |
| tree | 178937e6b2229af4f6c48acd8f94b2390b206087 | |
| parent | 80187cf5badb43ec42f6025acaeb70688c494101 (diff) | |
| download | procd-891094aefcb28a376a43b7c539f599a8e0987e4d.tar.gz | |
rcS: avoid duplicate pending "running" calls
Since those can be triggered by instance restarts now, and since the calls
can wait for their service to be active, suppress duplicate concurrent script
calls in case of rapid consecutive crashes.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
| -rw-r--r-- | rcS.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -125,6 +125,16 @@ static void q_initd_complete(struct runqueue *q, struct runqueue_task *p) free(s); } +static bool find_runqueue_list_entry(struct list_head *list, char *file, char *param) +{ + struct initd *s; + + list_for_each_entry(s, list, proc.task.list.list) + if (!strcmp(s->file, file) && !strcmp(s->param, param)) + return true; + return false; +} + static void add_initd(struct runqueue *q, char *file, char *param) { static const struct runqueue_task_type initd_type = { @@ -135,6 +145,11 @@ static void add_initd(struct runqueue *q, char *file, char *param) struct initd *s; char *p, *f; + if (!strcmp(param, "running") && + (find_runqueue_list_entry(&q->tasks_active.list, file, param) || + find_runqueue_list_entry(&q->tasks_inactive.list, file, param))) + return; + s = calloc_a(sizeof(*s), &f, strlen(file) + 1, &p, strlen(param) + 1); if (!s) { ERROR("Out of memory in %s.\n", file); |