From 5d38ea056c82221a0ddc206cd57dd7c1852a3159 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 4 Dec 2016 13:44:23 +0000 Subject: Remove s6-tls* dependency to libs6net. Improve gen-deps to make dynlinking easier. --- src/stls/stls_clean_tls_and_spawn.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/stls/stls_clean_tls_and_spawn.c (limited to 'src/stls/stls_clean_tls_and_spawn.c') diff --git a/src/stls/stls_clean_tls_and_spawn.c b/src/stls/stls_clean_tls_and_spawn.c new file mode 100644 index 0000000..37ea619 --- /dev/null +++ b/src/stls/stls_clean_tls_and_spawn.c @@ -0,0 +1,21 @@ +/* ISC license. */ + +#include +#include +#include +#include "stls-internal.h" + +pid_t stls_clean_tls_and_spawn (char const *const *argv, char const *const *envp, int *fds, uint32_t options) +{ + if (!(options & 1)) return child_spawn2(argv[0], argv, envp, fds) ; + else + { + char const modifs[] = "CADIR\0CAFILE\0KEYFILE\0CERTFILE\0TLS_UID\0TLS_GID" ; + size_t modiflen = sizeof(modifs) ; + size_t n = env_len(envp) ; + char const *newenv[n + 7] ; + size_t newenvlen = env_merge(newenv, n+7, envp, n, modifs, modiflen) ; + if (!newenvlen) return 0 ; + return child_spawn2(argv[0], argv, newenv, fds) ; + } +} -- cgit v1.3.1