From c311761b1f0c8693f06997c55382849b9fb7541d Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 14 May 2016 23:32:45 +1000 Subject: [PATCH] ckdb - zombie killer --- src/ckdb.c | 3 +++ src/ckdb.h | 2 +- src/ckdb_data.c | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index 6bb8a85f..1a9f4e77 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -7252,6 +7252,9 @@ int main(int argc, char **argv) feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + // Zombie no go zone + signal(SIGCHLD, SIG_IGN); + global_ckp = &ckp; memset(&ckp, 0, sizeof(ckp)); ckp.loglevel = LOG_NOTICE; diff --git a/src/ckdb.h b/src/ckdb.h index 94faa91b..650e7990 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.109" +#define CKDB_VERSION DB_VERSION"-2.110" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_data.c b/src/ckdb_data.c index 6271c002..b9577e07 100644 --- a/src/ckdb_data.c +++ b/src/ckdb_data.c @@ -5022,6 +5022,7 @@ int check_events(EVENTS *events) } else { if (pid == 0) { char buf1[16], buf2[16], buf3[16], buf4[16]; + int e; snprintf(buf1, sizeof(buf1), "%d", events->id); snprintf(buf2, sizeof(buf2), "%d", limit); snprintf(buf3, sizeof(buf3), "%d", tyme); @@ -5030,10 +5031,11 @@ int check_events(EVENTS *events) execl(cmd, cmd, buf1, name, buf2, buf3, buf4, events->createinet, st, cause_str(cause), NULL); + e = errno; LOGERR("%s() ALERT fork failed to execute (%d)", - __func__, errno); + __func__, e); FREENULL(st); - exit(0); + _exit(0); } } return lifetime;