summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-11-04 15:56:31 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-11-04 15:56:31 +0000
commitf755f36055637665f6598d516a5102d034f5e6c9 (patch)
treec8f1428070e3ed2a8bca0d6e64a7ada5ff5cac93 /src
parent7b39228821386cf821a9c8e635053b326ff15ecc (diff)
downloads6-rc-f755f36055637665f6598d516a5102d034f5e6c9.tar.xz
Warn on misplaced pipeline-name files
Diffstat (limited to 'src')
-rw-r--r--src/s6-rc/s6-rc-compile.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index 5f7c4d0..af0e5c9 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -436,13 +436,23 @@ static inline void add_longrun (before_t *be, int dirfd, char const *srcdir, cha
for (unsigned int i = 0 ; i < service.nproducers ; i++)
strerr_warni3x(name, " is a consumer for ", data.s + genalloc_s(unsigned int, &be->indices)[service.prodindex + i]) ;
}
- if (fd == 2 && add_namelist(be, dirfd, srcdir, name, "pipeline-name", &relatedindex, &n))
+ if (fd == 2)
{
- if (n != 1)
- strerr_dief5x(1, srcdir, "/", name, "/pipeline-name", " should only contain one name") ;
- service.pipelinename = genalloc_s(unsigned int, &be->indices)[relatedindex] ;
- genalloc_setlen(unsigned int, &be->indices, relatedindex) ;
+ if (add_namelist(be, dirfd, srcdir, name, "pipeline-name", &relatedindex, &n))
+ {
+ if (n != 1)
+ strerr_dief5x(1, srcdir, "/", name, "/pipeline-name", " should only contain one name") ;
+ service.pipelinename = genalloc_s(unsigned int, &be->indices)[relatedindex] ;
+ genalloc_setlen(unsigned int, &be->indices, relatedindex) ;
+ }
+ }
+ else if (faccessat(dirfd, "pipeline-name", F_OK, 0) < 0)
+ {
+ if (errno != ENOENT)
+ strerr_diefu5sys(111, "access ", srcdir, "/", name, "/pipeline-name") ;
}
+ else if (verbosity)
+ strerr_warnw4x(srcdir, "/", name, " contains a pipeline-name file despite not being a last consumer; this file will be ignored") ;
if (!genalloc_append(longrun_t, &be->longruns, &service)) dienomem() ;
}