summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--doc/index.html2
-rw-r--r--package/modes6
-rw-r--r--src/s6-rc/s6-rc-compile.c40
4 files changed, 28 insertions, 22 deletions
diff --git a/INSTALL b/INSTALL
index c0a692f..3145866 100644
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,7 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 4.0 or later
- skalibs version 2.3.6.0 or later: http://skarnet.org/software/skalibs/
- - execline version 2.1.2.2 or later: http://skarnet.org/software/execline/
+ - execline version 2.1.3.0 or later: http://skarnet.org/software/execline/
- s6 version 2.2.0.0 or later: http://skarnet.org/software/s6/
This software will run on any operating system that implements
diff --git a/doc/index.html b/doc/index.html
index ab997dd..c889800 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -49,7 +49,7 @@ scripts are also run in a controlled environment.
<li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version
2.3.6.0 or later </li>
<li> <a href="http://skarnet.org/software/execline/">execline</a> version
-2.1.2.2 or later </li>
+2.1.3.0 or later </li>
<li> <a href="http://skarnet.org/software/s6/">s6</a> version
2.2.0.0 or later </li>
</ul>
diff --git a/package/modes b/package/modes
index 0a1ebe0..7bda1d0 100644
--- a/package/modes
+++ b/package/modes
@@ -1,6 +1,6 @@
s6-rc-compile 0755
s6-rc-db 0755
s6-rc-dryrun 0755
-s6-rc-init 0700
-s6-rc 0700
-s6-rc-update 0700
+s6-rc-init 0755
+s6-rc 0755
+s6-rc-update 0755
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index 7e4e515..3324637 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -30,7 +30,7 @@
#define dienomem() strerr_dief1x(111, "out of memory") ;
#define S6RC_ONESHOT_RUNNER_RUNSCRIPT \
-"#!" EXECLINE_EXTBINPREFIX "execlineb -P\n" \
+"#!" EXECLINE_SHEBANGPREFIX "execlineb -P\n" \
EXECLINE_EXTBINPREFIX "fdmove -c 2 1\n" \
EXECLINE_EXTBINPREFIX "fdmove 1 3\n" \
S6_EXTBINPREFIX "s6-ipcserver-socketbinder -- s\n" \
@@ -295,23 +295,29 @@ static int add_namelist (before_t *be, int dirfd, char const *srcdir, char const
return 1 ;
}
-static void read_script (before_t *be, int dirfd, char const *srcdir, char const *name, char const *script, unsigned int *argvindex, unsigned int *argc)
+static void read_script (before_t *be, int dirfd, char const *srcdir, char const *name, char const *script, unsigned int *argvindex, unsigned int *argc, int mandatory)
{
- buffer b ;
- int r ;
- char buf[4096] ;
+ int r = 0 ;
int fd = open_readatb(dirfd, script) ;
- if (fd < 0) strerr_diefu6sys(111, "open ", srcdir, "/", name, "/", script) ;
- buffer_init(&b, &fd_readsv, fd, buf, 4096) ;
*argvindex = keep.len ;
- r = el_parse_from_buffer(&keep, &b) ;
- switch (r)
+ if (fd < 0)
{
- case -3 : strerr_dief7x(1, "syntax error in ", srcdir, "/", name, "/", script, ": missing }");
- case -2 : strerr_dief6x(1, "syntax error in ", srcdir, "/", name, "/", script) ;
- case -1 : strerr_diefu6sys(111, "parse ", srcdir, "/", name, "/", script) ;
+ if (errno != ENOENT || mandatory)
+ strerr_diefu6sys(111, "open ", srcdir, "/", name, "/", script) ;
+ }
+ else
+ {
+ char buf[4096] ;
+ buffer b = BUFFER_INIT(&fd_readsv, fd, buf, 4096) ;
+ r = el_parse_from_buffer(&keep, &b) ;
+ switch (r)
+ {
+ case -3 : strerr_dief7x(1, "syntax error in ", srcdir, "/", name, "/", script, ": missing }");
+ case -2 : strerr_dief6x(1, "syntax error in ", srcdir, "/", name, "/", script) ;
+ case -1 : strerr_diefu6sys(111, "parse ", srcdir, "/", name, "/", script) ;
+ }
+ close(fd) ;
}
- close(fd) ;
*argc = r ;
be->nargvs += r+1 ;
}
@@ -357,8 +363,8 @@ static inline void add_oneshot (before_t *be, int dirfd, char const *srcdir, cha
oneshot_t service ;
if (verbosity >= 3) strerr_warni3x(name, " has type ", "oneshot") ;
add_common(be, dirfd, srcdir, name, &service.common, SVTYPE_ONESHOT) ;
- read_script(be, dirfd, srcdir, name, "up", &service.argvindex[1], &service.argc[1]) ;
- read_script(be, dirfd, srcdir, name, "down", &service.argvindex[0], &service.argc[0]) ;
+ read_script(be, dirfd, srcdir, name, "up", &service.argvindex[1], &service.argc[1], 1) ;
+ read_script(be, dirfd, srcdir, name, "down", &service.argvindex[0], &service.argc[0], 0) ;
if (uint_uniq(genalloc_s(unsigned int, &be->indices) + service.common.depindex, service.common.ndeps, 0))
{
if (!genalloc_append(unsigned int, &be->indices, &special_dep)) dienomem() ;
@@ -494,8 +500,8 @@ static inline void add_sources (before_t *be, char const *srcdir)
strerr_dief3x(2, "subdirectory of ", srcdir, " contains a newline character") ;
satmp.len = cur ;
if (!stralloc_catb(&satmp, d->d_name, str_len(d->d_name) + 1)) dienomem() ;
- if (lstat(satmp.s + start, &st) < 0)
- strerr_diefu2sys(111, "lstat ", satmp.s + start) ;
+ if (stat(satmp.s + start, &st) < 0)
+ strerr_diefu2sys(111, "stat ", satmp.s + start) ;
if (!S_ISDIR(st.st_mode)) continue ;
fd = open_readb(satmp.s + start) ;
if (fd < 0) strerr_diefu2sys(111, "open ", satmp.s + start) ;