summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tlsd.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-21 11:51:08 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-21 11:51:08 +0000
commit7f2cd05720e721c7e8131d4a4762d97a29fbf7b4 (patch)
tree0c9f5e4647b8e63c295a05f0439bd1c54c5bbbeb /src/conn-tools/s6-tlsd.c
parent2269af1457817b7a3b9b51cc0512d5f29e1fc7a5 (diff)
downloads6-networking-7f2cd05720e721c7e8131d4a4762d97a29fbf7b4.tar.xz
Add s6-ucspitlsc
Diffstat (limited to 'src/conn-tools/s6-tlsd.c')
-rw-r--r--src/conn-tools/s6-tlsd.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/conn-tools/s6-tlsd.c b/src/conn-tools/s6-tlsd.c
index e048a49..361502e 100644
--- a/src/conn-tools/s6-tlsd.c
+++ b/src/conn-tools/s6-tlsd.c
@@ -15,8 +15,8 @@
#define USAGE "s6-tlsd [ -S | -s ] [ -Y | -y ] [ -v verbosity ] [ -K timeout ] [ -Z | -z ] prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static void child (int const [3][2], uint32_t, unsigned int, unsigned int) gccattr_noreturn ;
-static void child (int const p[3][2], uint32_t options, unsigned int verbosity, unsigned int kimeout)
+static void child (int const [4][2], uint32_t, unsigned int, unsigned int) gccattr_noreturn ;
+static void child (int const p[4][2], uint32_t options, unsigned int verbosity, unsigned int kimeout)
{
int fds[3] = { p[0][0], p[1][1], p[2][1] } ;
PROG = "s6-tlsd (child)" ;
@@ -30,9 +30,9 @@ int main (int argc, char const *const *argv)
{
unsigned int verbosity = 1 ;
unsigned int kimeout = 0 ;
- int p[3][2] ;
- uint32_t options = 0 ;
- int cleanenv = 1 ;
+ int p[4][2] = { [3] = { 0, 1 } } ;
+ uint32_t coptions = 0 ;
+ uint32_t poptions = 1 ;
pid_t pid ;
PROG = "s6-tlsd (parent)" ;
@@ -44,14 +44,14 @@ int main (int argc, char const *const *argv)
if (opt == -1) break ;
switch (opt)
{
- case 'S' : options |= 4 ; break ;
- case 's' : options &= ~4 ; break ;
- case 'Y' : options |= 1 ; options &= ~2 ; break ;
- case 'y' : options |= 3 ; break ;
+ case 'S' : coptions |= 4 ; break ;
+ case 's' : coptions &= ~4 ; break ;
+ case 'Y' : coptions |= 1 ; coptions &= ~2 ; break ;
+ case 'y' : coptions |= 3 ; break ;
case 'v' : if (!uint0_scan(l.arg, &verbosity)) dieusage() ; break ;
case 'K' : if (!uint0_scan(l.arg, &kimeout)) dieusage() ; break ;
- case 'Z' : cleanenv = 0 ; break ;
- case 'z' : cleanenv = 1 ; break ;
+ case 'Z' : poptions &= ~1 ; break ;
+ case 'z' : poptions |= 1 ; break ;
default : dieusage() ;
}
}
@@ -65,9 +65,8 @@ int main (int argc, char const *const *argv)
switch (pid)
{
case -1 : strerr_diefu1sys(111, "fork") ;
- case 0 : child(p, options, verbosity, kimeout) ;
+ case 0 : child(p, coptions, verbosity, kimeout) ;
default : break ;
}
-
- s6tls_wait_and_exec_app(argv, p, pid, 0, 1, cleanenv ? 1 : 0) ;
+ s6tls_sync_and_exec_app(argv, p, pid, poptions) ;
}