aboutsummaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-01-30 14:52:52 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-01-30 14:52:52 +0200
commit7f20aa4f7e26d8f740b55bef98f0c3c78eca0e79 (patch)
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')
-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)
45} 45}
46 46
47void 47void
48component_link (struct component *comp, struct component *ref, int before) 48component_link (struct component *comp, struct component *ref)
49{ 49{
50 if (!ref) 50 if (!ref)
51 { 51 {
52 struct complist *list = &comp_list[comp->listidx]; 52 struct complist *list = &comp_list[comp->listidx];
53 53
54 comp->next = NULL; 54 comp->prev = NULL;
55 comp->prev = list->tail; 55 comp->next = list->head;
56 if (list->tail) 56 if (list->head)
57 list->tail->next = comp; 57 list->head->prev = comp;
58 else 58 else
59 list->head = comp; 59 list->tail = comp;
60 list->tail = comp; 60 list->head = comp;
61 } 61 }
62 else if (before)
63 component_link (comp, ref->prev, 0);
64 else 62 else
65 { 63 {
66 struct complist *list = &comp_list[comp->listidx]; 64 struct complist *list = &comp_list[comp->listidx];
@@ -81,6 +79,12 @@ component_link (struct component *comp, struct component *ref, int before)
81} 79}
82 80
83void 81void
82component_append (struct component *comp)
83{
84 component_link (comp, comp_list[comp->listidx].tail);
85}
86
87void
84component_unlink (struct component *comp) 88component_unlink (struct component *comp)
85{ 89{
86 struct complist *list = &comp_list[comp->listidx]; 90 struct complist *list = &comp_list[comp->listidx];
@@ -132,7 +136,7 @@ component_create (const char *name)
132 comp->redir[RETR_OUT].type = comp->redir[RETR_ERR].type = redir_null; 136 comp->redir[RETR_OUT].type = comp->redir[RETR_ERR].type = redir_null;
133 comp->tag = grecs_strdup (name); 137 comp->tag = grecs_strdup (name);
134 comp->socket_type = SOCK_STREAM; 138 comp->socket_type = SOCK_STREAM;
135 component_link (comp, NULL, 0); 139 component_append (comp);
136 } 140 }
137 return comp; 141 return comp;
138} 142}
@@ -164,7 +168,6 @@ component_free (struct component *comp)
164 pies_privs_free (&comp->privs); 168 pies_privs_free (&comp->privs);
165 free (comp->runlevels); 169 free (comp->runlevels);
166 free_limits (comp->limits); 170 free_limits (comp->limits);
167 free (comp->runlevels);
168 free (comp->service); 171 free (comp->service);
169 pies_url_destroy (&comp->socket_url); 172 pies_url_destroy (&comp->socket_url);
170 free (comp->pass_fd_socket); 173 free (comp->pass_fd_socket);
@@ -487,7 +490,7 @@ component_config_commit (void)
487 component_merge (match, comp); 490 component_merge (match, comp);
488 component_unlink (match); 491 component_unlink (match);
489 match->listidx = cur; 492 match->listidx = cur;
490 component_link (match, comp, 1); 493 component_link (match, comp->prev);
491 component_free (comp); 494 component_free (comp);
492 comp = match; 495 comp = match;
493 } 496 }

Return to:

Send suggestions and report system problems to the System administrator.