summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-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/s6-rc/s6-rc-fdholder-filler.c43
6 files changed, 48 insertions, 24 deletions
diff --git a/COPYING b/COPYING
index c0a0ab4..2475f17 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2023 Laurent Bercot <ska-skaware@skarnet.org>
+Copyright (c) 2015-2024 Laurent Bercot <ska-skaware@skarnet.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/NEWS b/NEWS
index 4b41cff..e4b5001 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changelog for s6-rc.
+In 0.5.4.3
+----------
+
+ - Bugfixes.
+
+
In 0.5.4.2
----------
diff --git a/doc/index.html b/doc/index.html
index 3b774d6..e27eb70 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.14.0.0 or later. It's a build-time requirement. It's also a run-time
+2.14.1.1 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.9.4.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
+2.9.5.1 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.12.0.0 or later. It's a build-time <em>and</em> run-time requirement. </li>
+2.12.0.5 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.4.2.tar.gz">0.5.4.2</a>. </li>
+<a href="s6-rc-0.5.4.3.tar.gz">0.5.4.3</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 64eeec3..89f49d6 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.4.3 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
+dependency bumped to 2.14.1.1. </li>
+ <li> <a href="//skarnet.org/software/execline/">execline</a>
+dependency bumped to 2.9.5.1. </li>
+ <li> <a href="//skarnet.org/software/s6/">s6</a>
+dependency bumped to 2.12.0.5. </li>
+</ul>
+
<h2> in 0.5.4.2 </h2>
<ul>
diff --git a/package/info b/package/info
index 9a9e245..8f6e8ad 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-rc
-version=0.5.4.2
+version=0.5.4.3
category=admin
package_macro_name=S6RC
diff --git a/src/s6-rc/s6-rc-fdholder-filler.c b/src/s6-rc/s6-rc-fdholder-filler.c
index 81023bc..3f9b509 100644
--- a/src/s6-rc/s6-rc-fdholder-filler.c
+++ b/src/s6-rc/s6-rc-fdholder-filler.c
@@ -5,20 +5,22 @@
#include <errno.h>
#include <skalibs/types.h>
-#include <skalibs/strerr.h>
#include <skalibs/sgetopt.h>
+#include <skalibs/strerr.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/tai.h>
+#include <skalibs/buffer.h>
+#include <skalibs/stralloc.h>
#include <s6/fdholder.h>
#define USAGE "s6-rc-fdholder-filler [ -1 ] [ -t timeout ] < autofilled-filename"
#define dieusage() strerr_dieusage(100, USAGE)
+#define dienomem() strerr_diefu1sys(111, "stralloc_catb")
#define N 16384
-#define BUFSIZE 65536
-static inline unsigned int class (char c)
+static inline unsigned int cclass (char c)
{
switch (c)
{
@@ -32,27 +34,37 @@ static inline unsigned int class (char c)
}
}
-static inline unsigned int parse_servicenames (char *s, size_t *indices)
+static inline char cnext (void)
{
- static unsigned char const table[3][5] =
+ char c ;
+ ssize_t r = buffer_get(buffer_0, &c, 1) ;
+ if (r == -1) strerr_diefu1sys(111, "read from stdin") ;
+ return r ? c : 0 ;
+}
+
+static inline unsigned int parse_servicenames (stralloc *sa, size_t *indices)
+{
+ static uint8_t const table[3][5] =
{
{ 3, 0, 1, 0, 6 },
{ 3, 0, 1, 1, 1 },
{ 3, 8, 2, 2, 2 }
} ;
- size_t pos = 0 ;
+ size_t pos = sa->len ;
size_t n = 0 ;
unsigned int state = 0 ;
for (; state < 3 ; pos++)
{
- unsigned char c = table[state][class(s[pos])] ;
+ char cur = cnext() ;
+ uint8_t c = table[state][cclass(cur)] ;
state = c & 3 ;
if (c & 4)
{
if (n >= N) strerr_dief1x(1, "too many fds") ;
indices[n++] = pos ;
}
- if (c & 8) s[pos] = 0 ;
+ if (c & 8) { if (!stralloc_0(sa)) dienomem() ; }
+ else if (!stralloc_catb(sa, &cur, 1)) dienomem() ;
}
return n ;
}
@@ -60,11 +72,11 @@ static inline unsigned int parse_servicenames (char *s, size_t *indices)
int main (int argc, char const *const *argv)
{
s6_fdholder_t a = S6_FDHOLDER_ZERO ;
+ stralloc sa = STRALLOC_ZERO ;
tain deadline ;
int notif = 0 ;
size_t n ;
size_t indices[N] ;
- char buf[BUFSIZE] ;
PROG = "s6-rc-fdholder-filler" ;
{
unsigned int t = 0 ;
@@ -85,12 +97,7 @@ int main (int argc, char const *const *argv)
else deadline = tain_infinite_relative ;
}
- {
- size_t r = allread(0, buf, BUFSIZE) ;
- if (r >= BUFSIZE) strerr_dief3x(100, "file ", argv[0], " is too big") ;
- buf[r] = 0 ;
- }
- n = parse_servicenames(buf, indices) ;
+ n = parse_servicenames(&sa, indices) ;
if (n)
{
tain offset = { .sec = TAI_ZERO } ;
@@ -103,11 +110,11 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
for (; i < n ; i++)
{
- size_t len = strlen(buf + indices[i]) ;
+ size_t len = strlen(sa.s + indices[i]) ;
if (len + 12 > S6_FDHOLDER_ID_SIZE)
{
errno = ENAMETOOLONG ;
- strerr_diefu2sys(111, "create identifier for ", buf + indices[i]) ;
+ strerr_diefu2sys(111, "create identifier for ", sa.s + indices[i]) ;
}
if (pipe(p) < 0)
strerr_diefu1sys(111, "create pipe") ;
@@ -116,7 +123,7 @@ int main (int argc, char const *const *argv)
offset.nano = i << 1 ;
tain_add(&dump[i<<1].limit, &dump[i<<1].limit, &offset) ;
memcpy(dump[i<<1].id, "pipe:s6rc-r-", 12) ;
- memcpy(dump[i<<1].id + 12, buf + indices[i], len + 1) ;
+ memcpy(dump[i<<1].id + 12, sa.s + indices[i], len + 1) ;
dump[(i<<1)+1].fd = p[1] ;
offset.nano = 1 ;
tain_add(&dump[(i<<1)+1].limit, &dump[i<<1].limit, &offset) ;