From a9910041b32bcd3b1a4e0cb0e06576af2f227a69 Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 9 Jun 2002 16:53:57 +0000 Subject: [PATCH] now exits instead of restarting if child dies due to an unexpected signal. --- platform/CUnixPlatform.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/platform/CUnixPlatform.cpp b/platform/CUnixPlatform.cpp index 63fb77d2..99349ea7 100644 --- a/platform/CUnixPlatform.cpp +++ b/platform/CUnixPlatform.cpp @@ -102,11 +102,25 @@ int CUnixPlatform::restart( // what happened? if the child exited normally with a // status less than 16 then the child was deliberately - // terminated so we also terminate. otherwise, we - // loop. + // terminated so we also terminate. if (WIFEXITED(status) && WEXITSTATUS(status) < minErrorCode) { return WEXITSTATUS(status); } + + // did child die horribly? + if (WIFSIGNALED(status)) { + switch (WTERMSIG(status)) { + case SIGHUP: + case SIGINT: + case SIGQUIT: + case SIGTERM: + break; + + default: + // uh oh. bail out. + return 16; + } + } break; }