s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 49d082377b0614f6cf8503be0699524f936776c0
parent 502bfd940bfc39fe4eb256d8bd06cc5a15c098d3
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sun,  8 Feb 2015 22:24:51 +0000

 - cosmetic fixes in s6-fdholderd
 - timestamp length bugfix in s6-log

Diffstat:
Msrc/daemontools-extras/s6-log.c | 6+++---
Msrc/fdholder/s6-fdholderd.c | 4+---
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c @@ -912,11 +912,11 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char int flagselected = 1, flagacted = 0 ; unsigned int i = 0, hlen = 0 ; char hstamp[32] ; - char tstamp[TIMESTAMP] ; + char tstamp[TIMESTAMP+1] ; if (gflags & 1) { timestamp_g(tstamp) ; - tstamp[TIMESTAMP-1] = ' ' ; + tstamp[TIMESTAMP] = ' ' ; } if (gflags & 2) { @@ -953,7 +953,7 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char for (j = 0 ; j < script[i].actlen ; j++) { act_t const *act = script[i].acts + j ; - siovec_t v[4] = { { .s = tstamp, .len = act->flags & 1 ? TIMESTAMP : 0 }, { .s = hstamp, .len = act->flags & 2 ? hlen : 0 }, { .s = (char *)s, .len = len }, { .s = "\n", .len = 1 } } ; + siovec_t v[4] = { { .s = tstamp, .len = act->flags & 1 ? TIMESTAMP+1 : 0 }, { .s = hstamp, .len = act->flags & 2 ? hlen : 0 }, { .s = (char *)s, .len = len }, { .s = "\n", .len = 1 } } ; switch (act->type) { case ACTTYPE_FD1 : diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c @@ -452,8 +452,6 @@ static int do_setdump_data (unsigned int cc, unixmessage_t const *m) tain_unpack(s, &p->limit) ; byte_copy(p->id, idlen+1, s + TAIN_PACK + 1) ; p->fd = m->fds[i] ; - char fmt[TIMESTAMP] ; - fmt[timestamp_fmt(fmt, &p->limit)] = 0 ; avltreen_insert(fds_by_id, indices[i]) ; avltreen_insert(fds_by_deadline, indices[i]) ; s += TAIN_PACK + 2 + idlen ; len -= TAIN_PACK + 2 + idlen ; @@ -802,6 +800,6 @@ int main (int argc, char const *const *argv, char const *const *envp) else client_add(&i, fd, &rre, &wre, flags) ; } } - return (~!numfds | (!!numconn << 1)) ; + return (!!numfds | (!!numconn << 1)) ; } }