summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL6
-rw-r--r--NEWS6
-rw-r--r--doc/index.html8
-rw-r--r--doc/upgrade.html11
-rw-r--r--package/info2
-rw-r--r--src/libs6rc/s6rc_livedir_create.c4
-rw-r--r--src/libs6rc/s6rc_lock.c22
-rw-r--r--src/libs6rc/s6rc_servicedir_block.c3
-rw-r--r--src/libs6rc/s6rc_servicedir_copy_offline.c9
-rw-r--r--src/libs6rc/s6rc_servicedir_copy_online.c9
-rw-r--r--src/libs6rc/s6rc_servicedir_internal.c4
-rw-r--r--src/libs6rc/s6rc_servicedir_manage.c110
-rw-r--r--src/libs6rc/s6rc_servicedir_unsupervise.c26
-rw-r--r--src/s6-rc/s6-rc-compile.c6
-rw-r--r--src/s6-rc/s6-rc-fdholder-filler.c28
-rw-r--r--src/s6-rc/s6-rc-init.c11
-rw-r--r--src/s6-rc/s6-rc-oneshot-run.c5
-rw-r--r--src/s6-rc/s6-rc-update.c13
18 files changed, 125 insertions, 158 deletions
diff --git a/INSTALL b/INSTALL
index 920f043..dc36c88 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,9 +6,9 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 3.81 or later
- - skalibs version 2.9.3.0 or later: http://skarnet.org/software/skalibs/
- - execline version 2.6.1.1 or later: http://skarnet.org/software/execline/
- - s6 version 2.9.2.0 or later: http://skarnet.org/software/s6/
+ - skalibs version 2.10.0.0 or later: http://skarnet.org/software/skalibs/
+ - execline version 2.7.0.0 or later: http://skarnet.org/software/execline/
+ - s6 version 2.10.0.0 or later: http://skarnet.org/software/s6/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/NEWS b/NEWS
index 16673dc..ef38116 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changelog for s6-rc.
+In 0.5.2.1
+----------
+
+ - Adaptation to skalibs-2.10.0.0, execline-2.7.0.0 and s6-2.10.0.0
+
+
In 0.5.2.0
----------
diff --git a/doc/index.html b/doc/index.html
index 08cad57..d5293fb 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -48,12 +48,12 @@ scripts are also run in a controlled environment.
<li> A POSIX-compliant system with a standard C development environment </li>
<li> GNU make, version 3.81 or later </li>
<li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
-2.9.3.0 or later. It's a build-time requirement. It's also a run-time
+2.10.0.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs library. </li>
<li> <a href="//skarnet.org/software/execline/">execline</a> version
-2.6.1.1 or later. It's a build-time <em>and</em> run-time requirement. </li>
+2.7.0.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
<li> <a href="//skarnet.org/software/s6/">s6</a> version
-2.9.2.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
+2.10.0.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
</ul>
<h3> Licensing </h3>
@@ -67,7 +67,7 @@ requirement if you link against the shared version of the skalibs library. </li>
<ul>
<li> The current released version of s6-rc is
-<a href="s6-rc-0.5.2.0.tar.gz">0.5.2.0</a>. </li>
+<a href="s6-rc-0.5.2.1.tar.gz">0.5.2.1</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-rc/">s6-rc
git repository</a>:
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 9312335..0978f9e 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -30,6 +30,17 @@ minor and bugfix version changes.
<h1> What has changed in s6-rc </h1>
+<h2> in 0.5.2.1 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
+dependency bumped to 2.10.0.0. </li>
+ <li> <a href="//skarnet.org/software/execline/">execline</a>
+dependency bumped to 2.7.0.0. </li>
+ <li> <a href="//skarnet.org/software/s6/">s6</a>
+dependency bumped to 2.10.0.0. </li>
+</ul>
+
<h2> in 0.5.2.0 </h2>
<ul>
diff --git a/package/info b/package/info
index dadf0dd..0d11360 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-rc
-version=0.5.2.0
+version=0.5.2.1
category=admin
package_macro_name=S6RC
diff --git a/src/libs6rc/s6rc_livedir_create.c b/src/libs6rc/s6rc_livedir_create.c
index fd23a07..bd44bd6 100644
--- a/src/libs6rc/s6rc_livedir_create.c
+++ b/src/libs6rc/s6rc_livedir_create.c
@@ -10,7 +10,7 @@
#include <skalibs/djbunix.h>
#include <s6-rc/s6rc-utils.h>
-int s6rc_livedir_create (stralloc *sa, char const *live, char const *suffix, char const *scandir, char const *prefix, char const *compiled, unsigned char const *state, unsigned int statelen, size_t *dirlen)
+int s6rc_livedir_create (stralloc *sa, char const *live, char const *suffix, char const *scdir, char const *prefix, char const *compiled, unsigned char const *state, unsigned int statelen, size_t *dirlen)
{
size_t newlen, ddirlen ;
size_t sabase = sa->len ;
@@ -28,7 +28,7 @@ int s6rc_livedir_create (stralloc *sa, char const *live, char const *suffix, cha
strcpy(sa->s + newlen, "compiled") ;
if (symlink(compiled, sa->s + sabase) < 0) goto delerr ;
strcpy(sa->s + newlen, "scandir") ;
- if (symlink(scandir, sa->s + sabase) < 0) goto delerr ;
+ if (symlink(scdir, sa->s + sabase) < 0) goto delerr ;
strcpy(sa->s + newlen, "prefix") ;
if (!openwritenclose_unsafe(sa->s + sabase, prefix, strlen(prefix))) goto delerr ;
strcpy(sa->s + newlen, "state") ;
diff --git a/src/libs6rc/s6rc_lock.c b/src/libs6rc/s6rc_lock.c
index d3ae2b5..e879fcc 100644
--- a/src/libs6rc/s6rc_lock.c
+++ b/src/libs6rc/s6rc_lock.c
@@ -2,18 +2,10 @@
#include <string.h>
#include <errno.h>
-#include <skalibs/djbunix.h>
-#include <s6-rc/s6rc-utils.h>
-static inline int lockex (int fd, int blocking)
-{
- return blocking ? lock_ex(fd) : lock_exnb(fd) ;
-}
+#include <skalibs/djbunix.h>
-static inline int locksh (int fd, int blocking)
-{
- return blocking ? lock_sh(fd) : lock_shnb(fd) ;
-}
+#include <s6-rc/s6rc-utils.h>
int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int cwhat, int *ccfd, int blocking)
{
@@ -21,6 +13,7 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int
if (lwhat)
{
+ int r ;
size_t llen = strlen(live) ;
char lfn[llen + 6] ;
memcpy(lfn, live, llen) ;
@@ -28,7 +21,9 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int
lfd = open_create(lfn) ;
if (lfd < 0) return 0 ;
if (coe(lfd) < 0) goto lerr ;
- if ((lwhat > 1 ? lockex(lfd, blocking) : locksh(lfd, blocking)) < 0) goto lerr ;
+ r = fd_lock(lfd, lwhat > 1, !blocking) ;
+ if (!r) errno = EBUSY ;
+ if (r < 1) goto lerr ;
}
if (cwhat)
@@ -43,8 +38,11 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int
else cfd = -errno ;
else
{
+ int r ;
if (coe(cfd) < 0) goto cerr ;
- if ((cwhat > 1 ? lockex(cfd, blocking) : locksh(cfd, blocking)) < 0) goto cerr ;
+ r = fd_lock(cfd, cwhat > 1, !blocking) ;
+ if (!r) errno = EBUSY ;
+ if (r < 1) goto cerr ;
}
}
diff --git a/src/libs6rc/s6rc_servicedir_block.c b/src/libs6rc/s6rc_servicedir_block.c
index bfa6440..9038342 100644
--- a/src/libs6rc/s6rc_servicedir_block.c
+++ b/src/libs6rc/s6rc_servicedir_block.c
@@ -2,9 +2,12 @@
#include <string.h>
#include <unistd.h>
+
#include <skalibs/posixplz.h>
#include <skalibs/djbunix.h>
+
#include <s6/s6-supervise.h>
+
#include <s6-rc/s6rc-servicedir.h>
int s6rc_servicedir_block (char const *dir)
diff --git a/src/libs6rc/s6rc_servicedir_copy_offline.c b/src/libs6rc/s6rc_servicedir_copy_offline.c
index 6581a4f..b517536 100644
--- a/src/libs6rc/s6rc_servicedir_copy_offline.c
+++ b/src/libs6rc/s6rc_servicedir_copy_offline.c
@@ -2,16 +2,17 @@
#include <sys/stat.h>
#include <errno.h>
+
#include "s6rc-servicedir-internal.h"
#include <s6-rc/s6rc-servicedir.h>
int s6rc_servicedir_copy_offline (char const *src, char const *dst)
{
s6rc_servicedir_desc_t const *p = s6rc_servicedir_file_list ;
- if (mkdir(dst, 0755) < 0)
- {
- if (errno != EEXIST) return 0 ;
- }
+ mode_t m = umask(0) ;
+ int r = mkdir(dst, 0755) ;
+ umask(m) ;
+ if (r < 0 && errno != EEXIST) return 0 ;
for (; p->name ; p++)
if (!s6rc_servicedir_copy_one(src, dst, p)) return 0 ;
return 1 ;
diff --git a/src/libs6rc/s6rc_servicedir_copy_online.c b/src/libs6rc/s6rc_servicedir_copy_online.c
index e676d5a..5e84079 100644
--- a/src/libs6rc/s6rc_servicedir_copy_online.c
+++ b/src/libs6rc/s6rc_servicedir_copy_online.c
@@ -5,7 +5,9 @@
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
+
#include <skalibs/djbunix.h>
+
#include <s6-rc/s6rc-utils.h>
#include "s6rc-servicedir-internal.h"
#include <s6-rc/s6rc-servicedir.h>
@@ -27,7 +29,12 @@ int s6rc_servicedir_copy_online (char const *src, char const *dst)
memcpy(oldfn, dst, dstlen) ;
memcpy(oldfn + dstlen, "/old", 5) ;
if (rm_rf(oldfn) < 0 && errno != ENOENT) return 0 ;
- if (mkdir(oldfn, 0755) < 0) return 0 ;
+ {
+ mode_t m = umask(0) ;
+ int r = mkdir(oldfn, 0755) ;
+ umask(m) ;
+ if (r < 0) return 0 ;
+ }
dstfn[dstlen] = '/' ;
oldfn[dstlen + 4] = '/' ;
wantup = s6rc_servicedir_block(dst) ;
diff --git a/src/libs6rc/s6rc_servicedir_internal.c b/src/libs6rc/s6rc_servicedir_internal.c
index b70061f..f84b6fb 100644
--- a/src/libs6rc/s6rc_servicedir_internal.c
+++ b/src/libs6rc/s6rc_servicedir_internal.c
@@ -3,8 +3,11 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
+
+#include <skalibs/posixplz.h>
#include <skalibs/types.h>
#include <skalibs/djbunix.h>
+
#include <s6-rc/s6rc-utils.h>
#include "s6rc-servicedir-internal.h"
@@ -14,7 +17,6 @@ static s6rc_servicedir_desc_t const svdir_file_list[] =
{ .name = "finish.user", .type = FILETYPE_NORMAL, .options = SVFILE_EXECUTABLE },
{ .name = "run", .type = FILETYPE_NORMAL, .options = SVFILE_EXECUTABLE | SVFILE_MANDATORY | SVFILE_ATOMIC },
{ .name = "run.user", .type = FILETYPE_NORMAL, .options = SVFILE_EXECUTABLE },
- { .name = "nosetsid", .type = FILETYPE_EMPTY, .options = 0 },
{ .name = "notification-fd", .type = FILETYPE_UINT, .options = 0 },
{ .name = "timeout-kill", .type = FILETYPE_UINT, .options = 0 },
{ .name = "timeout-finish", .type = FILETYPE_UINT, .options = 0 },
diff --git a/src/libs6rc/s6rc_servicedir_manage.c b/src/libs6rc/s6rc_servicedir_manage.c
index 5449f35..e11e4e4 100644
--- a/src/libs6rc/s6rc_servicedir_manage.c
+++ b/src/libs6rc/s6rc_servicedir_manage.c
@@ -1,45 +1,26 @@
/* ISC license. */
#include <string.h>
-#include <stdint.h>
-#include <unistd.h>
#include <errno.h>
+
#include <skalibs/direntry.h>
-#include <skalibs/djbunix.h>
#include <skalibs/stralloc.h>
-#include <skalibs/genalloc.h>
+
#include <s6/s6-supervise.h>
-#include <s6/ftrigr.h>
-#include <s6/ftrigw.h>
-#include <s6-rc/s6rc-servicedir.h>
-static inline void rollback (char const *live, char const *prefix, char const *s, size_t len)
-{
- while (len)
- {
- size_t n = strlen(s) + 1 ;
- s6rc_servicedir_unsupervise(live, prefix, s, 0) ;
- s += n ; len -= n ;
- }
-}
+#include <s6-rc/s6rc-servicedir.h>
int s6rc_servicedir_manage (char const *live, char const *prefix, tain_t const *deadline, tain_t *stamp)
{
- ftrigr_t a = FTRIGR_ZERO ;
- stralloc newnames = STRALLOC_ZERO ;
- genalloc ids = GENALLOC_ZERO ; /* uint16_t */
- gid_t gid = getgid() ;
+ stralloc names = STRALLOC_ZERO ;
size_t livelen = strlen(live) ;
- size_t prefixlen = strlen(prefix) ;
- int fdlock ;
- int ok = 1 ;
+ size_t n = 0 ;
DIR *dir ;
char dirfn[livelen + 13] ;
- if (!ftrigr_startf(&a, deadline, stamp)) return 0 ;
memcpy(dirfn, live, livelen) ;
memcpy(dirfn + livelen, "/servicedirs", 13) ;
dir = opendir(dirfn) ;
- if (!dir) goto closederr ;
+ if (!dir) return -1 ;
for (;;)
{
direntry *d ;
@@ -47,77 +28,28 @@ int s6rc_servicedir_manage (char const *live, char const *prefix, tain_t const *
d = readdir(dir) ;
if (!d) break ;
if (d->d_name[0] == '.') continue ;
- {
- size_t len = strlen(d->d_name) ;
- int r ;
- uint16_t id ;
- char srcfn[livelen + 20 + len] ;
- char dstfn[livelen + 10 + prefixlen + len] ;
- memcpy(srcfn, dirfn, livelen + 12) ;
- srcfn[livelen + 12] = '/' ;
- memcpy(srcfn + livelen + 13, d->d_name, len + 1) ;
- fdlock = s6_svc_lock_take(srcfn) ;
- if (fdlock < 0) goto err ;
- r = s6_svc_ok(srcfn) ;
- if (r < 0) goto erru ;
- if (!r)
- {
- memcpy(srcfn + livelen + 13 + len, "/down", 6) ;
- if (!touch(srcfn)) goto erru ;
- memcpy(srcfn + livelen + 14 + len, "event", 6) ;
- if (!ftrigw_fifodir_make(srcfn, gid, 0)) goto erru ;
- id = ftrigr_subscribe(&a, srcfn, "s", 0, deadline, stamp) ;
- if (!id) goto erru ;
- s6_svc_lock_release(fdlock) ;
- if (!genalloc_append(uint16_t, &ids, &id)) goto err ;
- srcfn[livelen + 13 + len] = 0 ;
- }
- else s6_svc_lock_release(fdlock) ;
- memcpy(dstfn, live, livelen) ;
- memcpy(dstfn + livelen, "/scandir/", 9) ;
- memcpy(dstfn + livelen + 9, prefix, prefixlen) ;
- memcpy(dstfn + livelen + 9 + prefixlen, d->d_name, len + 1) ;
- if (symlink(srcfn, dstfn) < 0)
- {
- if (!r || errno != EEXIST) goto err ;
- }
- else if (!r)
- {
- if (!stralloc_catb(&newnames, d->d_name, len + 1))
- {
- s6rc_servicedir_unsupervise(live, prefix, d->d_name, 0) ;
- goto err ;
- }
- }
- }
+ if (!stralloc_catb(&names, dirfn, livelen + 12)
+ || !stralloc_catb(&names, "/", 1)
+ || !stralloc_cats(&names, d->d_name)
+ || !stralloc_0(&names)) goto err ;
+ n++ ;
}
if (errno) goto err ;
dir_close(dir) ;
+ if (!n) return 0 ;
+ memcpy(dirfn + livelen + 1, "scandir", 8) ;
{
- char scanfn[livelen + 9] ;
+ char const *p = names.s ;
+ char const *servicedirs[n] ;
int r ;
- memcpy(scanfn, live, livelen) ;
- memcpy(scanfn + livelen, "/scandir", 9) ;
- r = s6_svc_writectl(scanfn, S6_SVSCAN_CTLDIR, "a", 1) ;
- if (r < 0) goto closederr ;
- if (!r) ok = 3 ;
- else if (ftrigr_wait_and(&a, genalloc_s(uint16_t, &ids), genalloc_len(uint16_t, &ids), deadline, stamp) < 0)
- goto closederr ;
+ for (size_t i = 0 ; i < n ; p += strlen(p) + 1) servicedirs[i++] = p ;
+ r = s6_supervise_link(dirfn, servicedirs, n, prefix, 0, deadline, stamp) ;
+ stralloc_free(&names) ;
+ return r ;
}
- ftrigr_end(&a) ;
- genalloc_free(uint16_t, &ids) ;
- stralloc_free(&newnames) ;
- return ok ;
-
- erru:
- s6_svc_lock_release(fdlock) ;
err:
dir_close(dir) ;
- closederr:
- ftrigr_end(&a) ;
- genalloc_free(uint16_t, &ids) ;
- rollback(live, prefix, newnames.s, newnames.len) ;
- stralloc_free(&newnames) ;
- return 0 ;
+ stralloc_free(&names) ;
+ return -1 ;
}
diff --git a/src/libs6rc/s6rc_servicedir_unsupervise.c b/src/libs6rc/s6rc_servicedir_unsupervise.c
index 2d15a70..44cc7b9 100644
--- a/src/libs6rc/s6rc_servicedir_unsupervise.c
+++ b/src/libs6rc/s6rc_servicedir_unsupervise.c
@@ -1,10 +1,9 @@
/* ISC license. */
-#include <errno.h>
#include <string.h>
-#include <unistd.h>
-#include <skalibs/posixplz.h>
+
#include <s6/s6-supervise.h>
+
#include <s6-rc/s6rc-servicedir.h>
void s6rc_servicedir_unsupervise (char const *live, char const *prefix, char const *name, int keepsupervisor)
@@ -12,18 +11,11 @@ void s6rc_servicedir_unsupervise (char const *live, char const *prefix, char con
size_t livelen = strlen(live) ;
size_t prefixlen = strlen(prefix) ;
size_t namelen = strlen(name) ;
- char fn[livelen + 14 + prefixlen + namelen] ;
- memcpy(fn, live, livelen) ;
- memcpy(fn + livelen, "/scandir/", 9) ;
- memcpy(fn + livelen + 9, prefix, prefixlen) ;
- memcpy(fn + livelen + 9 + prefixlen, name, namelen + 1) ;
- unlink_void(fn) ;
- if (!keepsupervisor)
- {
- int e = errno ;
- memcpy(fn + livelen + 1, "servicedirs/", 12) ;
- memcpy(fn + livelen + 13, name, namelen + 1) ;
- s6_svc_writectl(fn, S6_SUPERVISE_CTLDIR, "x", 1) ;
- errno = e ;
- }
+ char scdir[livelen + 9] ;
+ char fn[prefixlen + namelen + 1] ;
+ memcpy(scdir, live, livelen) ;
+ memcpy(scdir + livelen, "/scandir", 9) ;
+ memcpy(fn, prefix, prefixlen) ;
+ memcpy(fn + prefixlen, name, namelen + 1) ;
+ s6_supervise_unlink(scdir, fn, keepsupervisor ? 0 : 3) ;
}
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index 4414ded..6fb9d5e 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -1085,9 +1085,9 @@ static inline void write_fdholder (char const *compiled, s6rc_db_t const *db, ch
if (!stralloc_cats(&satmp,
"#!" EXECLINE_SHEBANGPREFIX "execlineb -P\n"
EXECLINE_EXTBINPREFIX "pipeline -dw --\n{\n "
- EXECLINE_EXTBINPREFIX "if -n --\n {\n "
- EXECLINE_EXTBINPREFIX "forstdin -x 1 -- i\n "
- EXECLINE_EXTBINPREFIX "exit 1\n }\n "
+ EXECLINE_EXTBINPREFIX "if --\n {\n "
+ EXECLINE_EXTBINPREFIX "forstdin -x0 -- i\n "
+ EXECLINE_EXTBINPREFIX "exit 0\n }\n "
EXECLINE_EXTBINPREFIX "if -nt --\n {\n "
EXECLINE_EXTBINPREFIX "redirfd -r 0 ./data/autofilled\n "
S6_EXTBINPREFIX "s6-ipcclient -l0 -- s\n "
diff --git a/src/s6-rc/s6-rc-fdholder-filler.c b/src/s6-rc/s6-rc-fdholder-filler.c
index abb0753..9b28bb1 100644
--- a/src/s6-rc/s6-rc-fdholder-filler.c
+++ b/src/s6-rc/s6-rc-fdholder-filler.c
@@ -3,11 +3,13 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
+
#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/tai.h>
+
#include <s6/s6-fdholder.h>
#define USAGE "s6-rc-fdholder-filler [ -1 ] [ -t timeout ] < autofilled-filename"
@@ -15,7 +17,21 @@
#define N 4096
-static unsigned int parse_servicenames (char *s, unsigned int *indices)
+static inline unsigned int class (char c)
+{
+ switch (c)
+ {
+ case 0 : return 0 ;
+ case '\n' : return 1 ;
+ case '#' : return 2 ;
+ case ' ' :
+ case '\r' :
+ case '\t' : return 3 ;
+ default : return 4 ;
+ }
+}
+
+static inline unsigned int parse_servicenames (char *s, unsigned int *indices)
{
static unsigned char const table[3][5] =
{
@@ -26,17 +42,9 @@ static unsigned int parse_servicenames (char *s, unsigned int *indices)
unsigned int pos = 0 ;
unsigned int n = 0 ;
unsigned int state = 0 ;
-
- unsigned char class[256] ;
- memset(class, 4, 256) ;
- class[0] = 0 ;
- class['\n'] = 1 ;
- class['#'] = 2 ;
- class[' '] = class['\r'] = class['\t'] = 3 ;
-
for (; state < 3 ; pos++)
{
- unsigned char c = table[state][class[(unsigned char)s[pos]]] ;
+ unsigned char c = table[state][class(s[pos])] ;
state = c & 3 ;
if (c & 4) indices[n++] = pos ;
if (c & 8) s[pos] = 0 ;
diff --git a/src/s6-rc/s6-rc-init.c b/src/s6-rc/s6-rc-init.c
index b591cc0..3398f23 100644
--- a/src/s6-rc/s6-rc-init.c
+++ b/src/s6-rc/s6-rc-init.c
@@ -5,6 +5,7 @@
#include <errno.h>
#include <stdlib.h>
+#include <skalibs/posixplz.h>
#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
@@ -118,14 +119,14 @@ int main (int argc, char const *const *argv)
strerr_diefu4sys(111, "symlink ", sa.s + dirlen, " to ", live) ;
}
- deref = s6rc_servicedir_manage_g(live, prefix, &deadline) ;
- if (!deref)
+ if (s6rc_servicedir_manage_g(live, prefix, &deadline) < 0)
{
unlink_void(live) ;
cleanup(&sa) ;
- strerr_diefu3sys(111, "supervise service directories in ", live, "/servicedirs") ;
+ if (errno == ENXIO)
+ strerr_diefu5x(100, "supervise service directories in ", live, "/servicedirs", ": s6-svscan not running on ", argv[0]) ;
+ else
+ strerr_diefu3sys(111, "supervise service directories in ", live, "/servicedirs") ;
}
- if (deref & 2)
- strerr_warnw2x("s6-svscan not running on ", argv[0]) ;
return 0 ;
}
diff --git a/src/s6-rc/s6-rc-oneshot-run.c b/src/s6-rc/s6-rc-oneshot-run.c
index d80f704..a544b74 100644
--- a/src/s6-rc/s6-rc-oneshot-run.c
+++ b/src/s6-rc/s6-rc-oneshot-run.c
@@ -9,6 +9,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
+#include <skalibs/exec.h>
#include <s6-rc/config.h>
#include <s6-rc/s6rc.h>
@@ -16,7 +17,7 @@
#define USAGE "s6-rc-oneshot-run [ -l live ] [ -b ] up|down servicenumber"
#define dieusage() strerr_dieusage(100, USAGE)
-int main (int argc, char const *const *argv, char const *const *envp)
+int main (int argc, char const *const *argv)
{
char const *live = S6RC_LIVE_BASE ;
unsigned int number ;
@@ -103,7 +104,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
char const **p = newargv ;
while (sargc--) *p++ = *sargv++ ;
*p = 0 ;
- xpathexec0_run(newargv, envp) ;
+ xexec0(newargv) ;
}
}
}
diff --git a/src/s6-rc/s6-rc-update.c b/src/s6-rc/s6-rc-update.c
index 56cce96..7308c5b 100644
--- a/src/s6-rc/s6-rc-update.c
+++ b/src/s6-rc/s6-rc-update.c
@@ -20,6 +20,7 @@
#include <skalibs/stralloc.h>
#include <skalibs/tai.h>
#include <skalibs/djbunix.h>
+#include <skalibs/exec.h>
#include <skalibs/skamisc.h>
#include <skalibs/unix-transactional.h>
@@ -764,9 +765,13 @@ int main (int argc, char const *const *argv, char const *const *envp)
make_new_livedir(oldstate, &olddb, newstate, &newdb, argv[0], invimage, prefix, &sa) ;
stralloc_free(&sa) ;
- r = s6rc_servicedir_manage_g(live, prefix, &deadline) ;
- if (!r) strerr_diefu2sys(111, "manage new service directories in ", live) ;
- if (r & 2) strerr_warnw3x("s6-svscan not running on ", live, "/scandir") ;
+ if (s6rc_servicedir_manage_g(live, prefix, &deadline) < 0)
+ {
+ if (errno == ENXIO)
+ strerr_diefu5x(100, "manage new service directories in ", live, ": s6-svscan not running on ", live, "/scandir") ;
+ else
+ strerr_diefu2sys(111, "manage new service directories in ", live) ;
+ }
/* Adjust stored pipes */
@@ -810,7 +815,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
newargv[m++] = 0 ;
if (verbosity >= 2)
strerr_warni1x("starting services in the new database") ;
- xpathexec_run(newargv[0], newargv, envp) ;
+ xexec_e(newargv, envp) ;
}
}
}