From dd4afee4a8ea8c44126c44b31c6f1a36582d0964 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 9 Dec 2020 18:27:43 +0000 Subject: Get rid of webipc.h --- src/conn-tools/s6-ipcclient.c | 2 +- src/conn-tools/s6-ipcserver-access.c | 2 +- src/conn-tools/s6-ipcserver-socketbinder.c | 11 ++++++----- src/conn-tools/s6-ipcserverd.c | 2 +- src/fdholder/s6-fdholderd.c | 3 ++- src/libs6/s6_fdholder_start.c | 4 ++-- src/libs6/s6_supervise_link.c | 7 ++++--- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/conn-tools/s6-ipcclient.c b/src/conn-tools/s6-ipcclient.c index 0b17853..1ec68dd 100644 --- a/src/conn-tools/s6-ipcclient.c +++ b/src/conn-tools/s6-ipcclient.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #define USAGE "s6-ipcclient [ -q | -Q | -v ] [ -p bindpath ] [ -l localname ] path prog..." diff --git a/src/conn-tools/s6-ipcserver-access.c b/src/conn-tools/s6-ipcserver-access.c index 752ecab..0356f60 100644 --- a/src/conn-tools/s6-ipcserver-access.c +++ b/src/conn-tools/s6-ipcserver-access.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/conn-tools/s6-ipcserver-socketbinder.c b/src/conn-tools/s6-ipcserver-socketbinder.c index f5abf67..ce63830 100644 --- a/src/conn-tools/s6-ipcserver-socketbinder.c +++ b/src/conn-tools/s6-ipcserver-socketbinder.c @@ -1,14 +1,15 @@ /* ISC license. */ +#include #include #include #include +#include #include #include #include -#include -#include +#include #include #define USAGE "s6-ipcserver-socketbinder [ -d | -D ] [ -b backlog ] [ -M | -m ] [ -a perms ] [ -B ] path prog..." @@ -19,7 +20,7 @@ int main (int argc, char const *const *argv) unsigned int backlog = SOMAXCONN ; int flagreuse = 1 ; int flagdgram = 0 ; - int flagblocking = 0 ; + unsigned int flags = O_NONBLOCK ; unsigned int perms = 0777 ; PROG = "s6-ipcserver-socketbinder" ; { @@ -34,7 +35,7 @@ int main (int argc, char const *const *argv) case 'd' : flagreuse = 1 ; break ; case 'M' : flagdgram = 0 ; break ; case 'm' : flagdgram = 1 ; break ; - case 'B' : flagblocking = 1 ; break ; + case 'B' : flags = 0 ; break ; case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ; case 'a' : if (!uint0_oscan(l.arg, &perms)) dieusage() ; break ; default : dieusage() ; @@ -44,7 +45,7 @@ int main (int argc, char const *const *argv) } if (argc < 2) dieusage() ; close(0) ; - if (flagdgram ? ipc_datagram_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB) : ipc_stream_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB)) + if (flagdgram ? ipc_datagram_internal(flags) : ipc_stream_internal(flags)) strerr_diefu1sys(111, "create socket") ; { diff --git a/src/conn-tools/s6-ipcserverd.c b/src/conn-tools/s6-ipcserverd.c index 9edb4ad..6a8f84e 100644 --- a/src/conn-tools/s6-ipcserverd.c +++ b/src/conn-tools/s6-ipcserverd.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #define USAGE "s6-ipcserverd [ -v verbosity ] [ -1 ] [ -P | -p ] [ -c maxconn ] [ -C localmaxconn ] prog..." diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c index 47e1f17..bacd42c 100644 --- a/src/fdholder/s6-fdholderd.c +++ b/src/fdholder/s6-fdholderd.c @@ -27,11 +27,12 @@ #include #include #include -#include +#include #include #include #include #include + #include #include diff --git a/src/libs6/s6_fdholder_start.c b/src/libs6/s6_fdholder_start.c index 2fb81d8..38bbfb2 100644 --- a/src/libs6/s6_fdholder_start.c +++ b/src/libs6/s6_fdholder_start.c @@ -1,8 +1,8 @@ /* ISC license. */ #include -#include -#include +#include + #include int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain_t const *deadline, tain_t *stamp) diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c index 118d66c..4258e18 100644 --- a/src/libs6/s6_supervise_link.c +++ b/src/libs6/s6_supervise_link.c @@ -68,9 +68,9 @@ int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t } { + stralloc lnames = STRALLOC_ZERO ; ftrigr_t a = FTRIGR_ZERO ; stralloc rpsa = STRALLOC_ZERO ; - stralloc lnames = STRALLOC_ZERO ; gid_t gid = options & 2 ? -1 : getegid() ; size_t scdirlen = strlen(scdir) ; size_t prefixlen = strlen(prefix) ; @@ -91,13 +91,14 @@ int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t char *p ; size_t len = strlen(servicedirs[i]) ; memcpy(fn, servicedirs[i], len) ; - memcpy(fn + len, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ; + fn[len] = '/' ; + memcpy(fn + len + 1, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ; if (!ftrigw_fifodir_make(fn, gid, options & 1)) goto err ; ids[m] = ftrigr_subscribe(&a, fn, "s", 0, deadline, stamp) ; if (!ids[m++]) goto err ; if (bitarray_peek(logged, i)) { - memcpy(fn + len, "/log/", 5) ; + memcpy(fn + len + 1, "log/", 4) ; memcpy(fn + len + 5, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ; if (!ftrigw_fifodir_make(fn, gid, options & 1)) goto err ; ids[m] = ftrigr_subscribe(&a, fn, "s", 0, deadline, stamp) ; -- cgit v1.2.3