commit b81af6ef42a9f559731d99c0d65ca5505fb6f910
parent 1d18c381b68851ec63450f8199c4380157422f42
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 17 Nov 2020 21:44:37 +0000
bugfix: s6-permafailon *also* did not init the sigset >.>
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/supervision/s6-permafailon.c b/src/supervision/s6-permafailon.c
@@ -3,20 +3,24 @@
#include <sys/stat.h>
#include <string.h>
#include <signal.h>
+
#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/bitarray.h>
#include <skalibs/sig.h>
#include <skalibs/tai.h>
#include <skalibs/djbunix.h>
+
#include <s6/s6-supervise.h>
#define USAGE "s6-permafailon seconds deathcount statuslist prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static void list_scan (char const *s, unsigned char *codes, sigset_t *sigs)
+static inline void list_scan (char const *s, unsigned char *codes, sigset_t *sigs)
{
size_t pos = 0 ;
+ memset(codes, 0, 32) ;
+ sigemptyset(sigs) ;
while (s[pos])
{
unsigned int u ;
@@ -57,7 +61,7 @@ static void list_scan (char const *s, unsigned char *codes, sigset_t *sigs)
int main (int argc, char const *const *argv, char const *const *envp)
{
- unsigned char codes[32] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ;
+ unsigned char codes[32] ;
sigset_t sigs ;
unsigned int total, seconds, n ;
struct stat st ;