s6

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

commit 6ddb7d41b6c858f133191b0d5263120ed5222da0
parent eed8f99badcf66b530bbdf245fa03fdc553380c6
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sat, 24 Mar 2018 15:07:50 +0000

 Fix minor bugs in s6-permafailon

Diffstat:
Mpackage/deps.mak | 2+-
Msrc/supervision/deps-exe/s6-permafailon | 1+
Msrc/supervision/s6-permafailon.c | 8++++++--
Msrc/supervision/s6-svdt-clear.c | 1+
4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/package/deps.mak b/package/deps.mak @@ -247,7 +247,7 @@ s6-mkfifodir: EXTRA_LIBS := s6-mkfifodir: src/pipe-tools/s6-mkfifodir.o ${LIBS6} -lskarnet s6-notifyoncheck: EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} ${SPAWN_LIB} s6-notifyoncheck: src/supervision/s6-notifyoncheck.o ${LIBS6} -lskarnet -s6-permafailon: EXTRA_LIBS := +s6-permafailon: EXTRA_LIBS := ${TAINNOW_LIB} s6-permafailon: src/supervision/s6-permafailon.o ${LIBS6} -lskarnet s6-supervise: EXTRA_LIBS := ${TAINNOW_LIB} s6-supervise: src/supervision/s6-supervise.o ${LIBS6} -lskarnet diff --git a/src/supervision/deps-exe/s6-permafailon b/src/supervision/deps-exe/s6-permafailon @@ -1,2 +1,3 @@ ${LIBS6} -lskarnet +${TAINNOW_LIB} diff --git a/src/supervision/s6-permafailon.c b/src/supervision/s6-permafailon.c @@ -93,7 +93,11 @@ int main (int argc, char const *const *argv, char const *const *envp) } if (r < n) goto cont ; tain_uint(&mintime, seconds) ; - tain_sub(&mintime, &tab[r-1].stamp, &mintime) ; + { + tain_t now ; + tain_now(&now) ; + tain_sub(&mintime, &now, &mintime) ; + } for (unsigned int i = 0 ; i < r ; i++) { @@ -106,7 +110,7 @@ int main (int argc, char const *const *argv, char const *const *envp) char fmtn[UINT_FMT] ; fmtevent[uint_fmt(fmtevent, tab[i].sig ? tab[i].sig : tab[i].exitcode)] = 0 ; fmtseconds[uint_fmt(fmtseconds, seconds)] = 0 ; - fmtn[uint_fmt(fmtseconds, n)] = 0 ; + fmtn[uint_fmt(fmtn, n)] = 0 ; strerr_warni8x("PERMANENT FAILURE triggered after ", fmtn, " events involving ", tab[i].sig ? "signal " : "exit code ", fmtevent, " in the last ", fmtseconds, " seconds") ; return 125 ; } diff --git a/src/supervision/s6-svdt-clear.c b/src/supervision/s6-svdt-clear.c @@ -8,6 +8,7 @@ int main (int argc, char const *const *argv) { + PROG = "s6-svdt-clear" ; if (argc < 2) dieusage() ; if (!s6_dtally_write(argv[1], 0, 0)) strerr_diefu2sys(111, "clear death tally for service ", argv[1]) ;