summaryrefslogtreecommitdiffabout
path: root/src/comp.c
authorSergey Poznyakoff <gray@gnu.org>2016-01-30 12:52:52 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-01-30 12:52:52 (GMT)
commit7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79 (patch) (side-by-side diff)
treec32e862b002c167a36f4d0f0f1fb9a2f6d626d68 /src/comp.c
parente9379677a3c82753f0d29ef1c3490eec345db3c0 (diff)
downloadpies-7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79.tar.gz
pies-7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79.tar.bz2
Fix configuration reload and telinit q
* src/comp.c (component_link): Always link after the REF. component. If REF is NULL, link at list head. (component_append): New function. (component_create): Use component_append. (component_free): Fix double-free. * src/pies.c (pies_reload): Call sysvinit_runlevel_setup. * src/progman.c (progman_stop_component): Remove inactive components. * src/sysvinit.c (sysvinit_fifo_handler): Schedule ACTION_RELOAD. on receiving INIT_CMD_RUNLVL. (sysvinit_sigtrans): Don't handle SIGHUP.
Diffstat (limited to 'src/comp.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/comp.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/comp.c b/src/comp.c
index 539db93..5613e28 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -45,22 +45,20 @@ prev_index (void)
}
void
-component_link (struct component *comp, struct component *ref, int before)
+component_link (struct component *comp, struct component *ref)
{
if (!ref)
{
struct complist *list = &comp_list[comp->listidx];
- comp->next = NULL;
- comp->prev = list->tail;
- if (list->tail)
- list->tail->next = comp;
+ comp->prev = NULL;
+ comp->next = list->head;
+ if (list->head)
+ list->head->prev = comp;
else
- list->head = comp;
- list->tail = comp;
+ list->tail = comp;
+ list->head = comp;
}
- else if (before)
- component_link (comp, ref->prev, 0);
else
{
struct complist *list = &comp_list[comp->listidx];
@@ -81,6 +79,12 @@ component_link (struct component *comp, struct component *ref, int before)
}
void
+component_append (struct component *comp)
+{
+ component_link (comp, comp_list[comp->listidx].tail);
+}
+
+void
component_unlink (struct component *comp)
{
struct complist *list = &comp_list[comp->listidx];
@@ -132,7 +136,7 @@ component_create (const char *name)
comp->redir[RETR_OUT].type = comp->redir[RETR_ERR].type = redir_null;
comp->tag = grecs_strdup (name);
comp->socket_type = SOCK_STREAM;
- component_link (comp, NULL, 0);
+ component_append (comp);
}
return comp;
}
@@ -164,7 +168,6 @@ component_free (struct component *comp)
pies_privs_free (&comp->privs);
free (comp->runlevels);
free_limits (comp->limits);
- free (comp->runlevels);
free (comp->service);
pies_url_destroy (&comp->socket_url);
free (comp->pass_fd_socket);
@@ -487,7 +490,7 @@ component_config_commit (void)
component_merge (match, comp);
component_unlink (match);
match->listidx = cur;
- component_link (match, comp, 1);
+ component_link (match, comp->prev);
component_free (comp);
comp = match;
}

Return to:

Send suggestions and report system problems to the System administrator.