summaryrefslogtreecommitdiffabout
path: root/src/comp.c
authorSergey Poznyakoff <gray@gnu.org>2019-05-23 10:20:03 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-23 10:20:03 (GMT)
commit19c12f9e35055e626823c9dd730bd847bfcd2cb4 (patch) (side-by-side diff)
treea2cef89cf40a6bd65b1592d69499face14f683eb /src/comp.c
parentbd19f38853dad5a89abada6ee5e7a23c65173894 (diff)
downloadpies-19c12f9e35055e626823c9dd730bd847bfcd2cb4.tar.gz
pies-19c12f9e35055e626823c9dd730bd847bfcd2cb4.tar.bz2
Update copyright years
Diffstat (limited to 'src/comp.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/comp.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/src/comp.c b/src/comp.c
index fcd0a14..c3e998a 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1,5 +1,5 @@
/* This file is part of GNU Pies.
- Copyright (C) 2016-2017 Sergey Poznyakoff
+ Copyright (C) 2016-2019 Sergey Poznyakoff
GNU Pies is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ component_link (struct component *comp, struct component *ref)
if (!ref)
{
struct complist *list = &comp_list[comp->listidx];
-
+
comp->prev = NULL;
comp->next = list->head;
if (list->head)
@@ -68,7 +68,7 @@ component_link (struct component *comp, struct component *ref)
comp->prev = ref;
comp->next = ref->next;
-
+
if ((x = ref->next))
x->prev = comp;
else
@@ -89,7 +89,7 @@ component_unlink (struct component *comp)
{
struct complist *list = &comp_list[comp->listidx];
struct component *x;
-
+
if ((x = comp->prev))
x->next = comp->next;
else
@@ -98,7 +98,7 @@ component_unlink (struct component *comp)
x->prev = comp->prev;
else
list->tail = comp->prev;
-}
+}
int
component_list_is_empty (void)
@@ -129,7 +129,7 @@ component_lookup_index (const char *tag)
return i;
return -1;
}
-
+
struct component *
component_create (const char *name)
{
@@ -208,10 +208,10 @@ static int
argvcmp (char **a, char **b)
{
size_t i;
-
+
if (!a != !b)
return 1;
-
+
for (i = 0; a[i]; i++)
if (!b[i] || strcmp (b[i], a[i]))
return 1;
@@ -250,7 +250,7 @@ redirector_cmp (struct redirector const *a, struct redirector const *b)
return 0;
}
-
+
static int
component_match (struct component *comp, struct component *ref)
{
@@ -258,7 +258,7 @@ component_match (struct component *comp, struct component *ref)
#define EQ(memb) MATCH (comp->memb != ref->memb)
#define FN(memb,fun) MATCH (fun (comp->memb, ref->memb))
#define FNP(memb,fun) MATCH (fun (&comp->memb, &ref->memb))
-
+
EQ (mode);
FN (tag, safe_strcmp);
FN (program, safe_strcmp);
@@ -299,7 +299,7 @@ complist_find_match (int idx, struct component *ref)
{
struct complist *list = &comp_list[idx];
struct component *comp;
-
+
for (comp = list->head; comp && component_match (comp, ref);
comp = comp->next)
;
@@ -331,7 +331,7 @@ component_merge (struct component *comp, struct component *ref)
pies_acl_free (comp->list_acl);
comp->list_acl = ref->list_acl;
ref->list_acl = NULL;
-
+
pies_acl_free (comp->adm_acl);
comp->adm_acl = ref->adm_acl;
ref->adm_acl = NULL;
@@ -396,13 +396,13 @@ static void
report_cyclic_dependency (pies_depmap_t dp, size_t idx)
{
size_t i;
-
+
i = idx;
do
{
size_t n;
pies_depmap_pos_t pos;
-
+
logmsg_printf (LOG_NOTICE, "%s -> ", comp_array[i]->tag);
comp_array[i]->flags |= CF_REMOVE;
for (n = depmap_first (depmap, depmap_col, i, &pos);
@@ -422,7 +422,7 @@ report_cyclic_dependency (pies_depmap_t dp, size_t idx)
}
while (i != idx);
logmsg_printf (LOG_NOTICE, "%s\n", comp_array[idx]->tag);
-}
+}
void
comp_array_remove (size_t i)
@@ -440,7 +440,7 @@ component_build_depmap (void)
{
size_t i;
pies_depmap_t dp;
-
+
free (depmap);
depmap = depmap_alloc (comp_count);
for (i = 0; i < comp_count; )
@@ -465,7 +465,7 @@ component_build_depmap (void)
}
depmap_set (depmap, i, tgt);
}
-
+
if (comp->depend)
for (ep = comp->depend->head; ep; ep = ep->next)
{
@@ -480,7 +480,7 @@ component_build_depmap (void)
}
depmap_set (depmap, tgt, i);
}
-
+
i++;
}
@@ -494,7 +494,7 @@ component_build_depmap (void)
report_cyclic_dependency (dp, i);
}
-
+
for (i = 0; i < comp_count;)
if (comp_array[i]->flags & CF_REMOVE)
{
@@ -503,7 +503,7 @@ component_build_depmap (void)
}
else
i++;
-
+
free (dp);
}
@@ -552,7 +552,7 @@ component_config_commit (void)
progman_foreach (mark_prog, NULL);
pies_schedule_children (PIES_CHLD_GC);
}
-
+
/* Build dependency map */
component_build_depmap ();
@@ -603,7 +603,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
else if (!comp->argv)
COMPERR (grecs_error,
"%s", _("missing command line"));
-
+
if (ISCF_TCPMUX (comp->flags))
{
comp->mode = pies_comp_inetd;
@@ -616,7 +616,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
COMPERR (grecs_error,
"%s", _("\"internal\" used without \"service\""));
}
-
+
if (comp->pass_fd_socket && comp->mode != pies_comp_pass_fd)
COMPERR (grecs_error,
"%s", _("pass-fd-socket ignored: wrong mode"));
@@ -627,7 +627,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
COMPERR (grecs_error,
"%s", _("socket ignored: wrong mode"));
break;
-
+
case pies_comp_pass_fd:
if (!comp->pass_fd_socket)
COMPERR (grecs_error,
@@ -646,7 +646,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
"file name or chdir must be specified"));
}
/* Fall through */
-
+
case pies_comp_accept:
if (!comp->socket_url)
{
@@ -655,7 +655,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
return 1;
}
break;
-
+
case pies_comp_inetd:
if (ISCF_TCPMUX (comp->flags))
{
@@ -714,7 +714,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
default:
break;
}
-
+
for (i = RETR_OUT; i <= RETR_ERR; i++)
{
if (comp->redir[i].type == redir_file
@@ -733,7 +733,7 @@ component_verify (struct component *comp, grecs_locus_t *locus)
comp->redir[i].v.file);
}
}
-
+
return header;
#undef COMPERR
}
@@ -747,7 +747,7 @@ component_finish (struct component *comp, grecs_locus_t *locus)
comp->depend->cmp = list_str_cmp;
if (comp->privs.groups)
comp->privs.groups->cmp = list_str_cmp;
-
+
if (component_verify (comp, locus))
{
component_free (comp);
@@ -817,7 +817,7 @@ component_trace (size_t idx, enum pies_depmap_direction dir)
pies_depmap_pos_t pos;
size_t n;
int delim = ':';
-
+
logmsg_printf (LOG_NOTICE, "%s", comp_array[idx]->tag);
for (n = depmap_first (depmap, dir, idx, &pos);
n != (size_t)-1;
@@ -886,8 +886,3 @@ component_foreach (int (*filter) (struct component *, void *), void *data)
}
return rc;
}
-
-
-
-
-

Return to:

Send suggestions and report system problems to the System administrator.