diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-11-04 17:04:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-11-04 17:04:43 +0000 |
commit | 73afe31703da94ff099b3615db532f912ed85d86 (patch) | |
tree | e77a0a02749978870cfe22ef749d9fad60e775c4 /src | |
parent | 20255147bb02fda9fa7f5658267f206e03603a2a (diff) | |
download | s6-rc-73afe31703da94ff099b3615db532f912ed85d86.tar.xz |
... but erroring out early is safer.
Diffstat (limited to 'src')
-rw-r--r-- | src/s6-rc/s6-rc-compile.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c index 1aaee35..63dd82c 100644 --- a/src/s6-rc/s6-rc-compile.c +++ b/src/s6-rc/s6-rc-compile.c @@ -530,7 +530,7 @@ struct pipeline_recinfo_s unsigned int pipelinename ; } ; -static void add_tree_to_bundle_rec (struct pipeline_recinfo_s *recinfo, char const *name) +static servicetype_t add_tree_to_bundle_rec (struct pipeline_recinfo_s *recinfo, char const *name) { nameinfo_t const *info ; { @@ -538,14 +538,20 @@ static void add_tree_to_bundle_rec (struct pipeline_recinfo_s *recinfo, char con avltree_search(&names_map, name, &id) ; info = genalloc_s(nameinfo_t, &nameinfo) + id ; } - if (info->type != SVTYPE_LONGRUN) return ; /* will error out later */ + if (info->type != SVTYPE_LONGRUN) return info->type ; if (recinfo->bundle.n++ >= recinfo->nlong) strerr_dief4x(1, "pipeline ", data.s + recinfo->pipelinename, " is too long: possible loop involving ", name) ; if (verbosity >= 4) strerr_warni4x("adding ", name, " to pipeline ", data.s + recinfo->pipelinename) ; if (!genalloc_append(unsigned int, &recinfo->be->indices, &info->pos)) dienomem() ; for (unsigned int i = 0 ; i < recinfo->longruns[info->i].nproducers ; i++) - add_tree_to_bundle_rec(recinfo, data.s + genalloc_s(unsigned int, &recinfo->be->indices)[recinfo->longruns[info->i].prodindex + i]) ; + { + char *prodname = data.s + genalloc_s(unsigned int, &recinfo->be->indices)[recinfo->longruns[info->i].prodindex + i] ; + servicetype_t type = add_tree_to_bundle_rec(recinfo, prodname) ; + if (type != SVTYPE_LONGRUN) + strerr_dief6x(1, "longrun ", name, " declares a producer ", prodname, " of type ", typestr(type)) ; + } + return SVTYPE_LONGRUN ; } static inline void add_pipeline_bundles (before_t *be) |